随笔分类 -  typescript

typescript
摘要:使用全局 window 上自定义的属性,TypeScript 会报属性不存在, console.log(window.foo) // ❌ Property ‘foo’ does not exist on type 'Window & typeof globalThis'.ts(2339) 需要将自定 阅读全文
posted @ 2021-11-04 19:03 王猪猴 阅读(2190) 评论(0) 推荐(0) 编辑
摘要:主要分以下几步: 第一步,ts 生成 js 文件。 先安装ts: npm install -g typescript 检测安装成功后,tsc 命令把 ts 文件生成 js 文件,如下图: 第二步,dtsmake 通过 js 文件生成 d.ts 。 全局安装 dtsmake: npm i instal 阅读全文
posted @ 2021-11-04 18:57 王猪猴 阅读(4672) 评论(0) 推荐(0) 编辑
摘要:添加 typescript 依赖和 tsconfig.json $ yarn tsc --init 其中 yarn tsc --init 使用本地刚安装的 typescript 初始化了一个 tsconfig.json 含有很多默认配置的文件 修改 tsconfig.json 为以下内容 (可自行配 阅读全文
posted @ 2021-11-03 14:41 王猪猴 阅读(425) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示