随笔分类 - typescript
摘要:ts函数中,直接使用this会报错: "this" 隐式具有类型 "any",因为它没有类型注释。 应该以参数形式声明this,以防抖函数为例 function debounce(fn: Function, time: number) { let timer: number return funct
阅读全文
摘要:在 JavaScript 中,特别是在 TypeScript 和 Flow 类型系统中,import type 与 import 有一些重要的区别。 **import type** import type 是 TypeScript 和 Flow 中特有的语法,它允许你导入类型而不导入运行时的值。这通
阅读全文
摘要:我重新安装了项目的 npm 包,执行 ts 文件报错: tsc src/index.ts node_modules/@types/node/globals.d.ts:72:13 - error TS2403: Subsequent variable declarations must have th
阅读全文