摘要: import type only imports declarations to be used for type annotations and declarations. It always gets fully erased, so there’s no remnant of it at ru 阅读全文
posted @ 2022-08-24 14:44 Zhentiw 阅读(73) 评论(0) 推荐(0) 编辑
摘要: function isError(err: any): err is Error { return err instanceof Error; } try { somethingRisky() } catch(err: unknown) { if (isError(err)) { console.l 阅读全文
posted @ 2022-08-24 14:23 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要: In some ways // @ts-expect-error can act as a suppression comment, similar to // @ts-ignore. The difference is that // @ts-ignore will do nothing if t 阅读全文
posted @ 2022-08-24 01:46 Zhentiw 阅读(515) 评论(0) 推荐(0) 编辑