摘要: function somethingRisky() {} try { somethingRisky() } catch(err: unknown) { if (err instanceof Error) { console.log(err.stack) } else { console.log(er 阅读全文
posted @ 2020-11-15 22:56 Zhentiw 阅读(88) 评论(0) 推荐(0)
摘要: Typescript v3.9 introduces the @ts-expect-error assertion added to TypeScript 3.9. This assertion is more descriptive than @ts-ignore because, rather 阅读全文
posted @ 2020-11-15 22:45 Zhentiw 阅读(1069) 评论(0) 推荐(0)
摘要: type Corner = `${'top' | 'bottom'}-${ 'left' | 'right'}` type VerticalAlignment = "top" | "middle" | "bottom"; type HorizontalAlignment = "left" | "ce 阅读全文
posted @ 2020-11-15 22:25 Zhentiw 阅读(177) 评论(0) 推荐(0)
摘要: ...T: type Foo<T extends any[]> = [boolean, ...T, boolean] In previous typescript version, you can only put '...T' to the last element of array. Put n 阅读全文
posted @ 2020-11-15 22:19 Zhentiw 阅读(123) 评论(0) 推荐(0)