摘要: The definite assignment !: operator is used to suppress TypeScript’s objections about a class field being used, when it can’t be proven1 that it was i 阅读全文
posted @ 2022-08-03 20:11 Zhentiw 阅读(26) 评论(0) 推荐(0)
摘要: Requirements: function strBuilder(str) { return strBuilder; // TODO } var hello = strBuilder("Hello, "); var kyle = hello("Kyle"); var susan = hello(" 阅读全文
posted @ 2022-08-03 19:56 Zhentiw 阅读(28) 评论(0) 推荐(0)
摘要: value is Foo The first kind of user-defined type guard we will review is an is type guard. It is perfectly suited for our example above because it’s m 阅读全文
posted @ 2022-08-03 13:23 Zhentiw 阅读(62) 评论(0) 推荐(0)
摘要: class UnreachableError extends Error { constructor(_nvr: never, message: string) { super(message) } } class Car { drive() { console.log("vroom") } } c 阅读全文
posted @ 2022-08-03 01:59 Zhentiw 阅读(16) 评论(0) 推荐(0)