RN项目构建 (一)
https://reactnative.dev/docs/typescript
对TYPESCRIPT语言的支持
当创建react-native项目后,然后对其进行ts语言配置
1 | sudo npm install typescript -g # 全局安装 |
1 | yarn add -D typescript # 项目根目录安装 |
1 | yarn add -g typings #项目添加TypeScript类型支持 |
然后发现执行yarn add -g typings
时, 直接报错了
1 | ➜ xxx (master) ✗ yarn add -g typings |
查看 typings,发现已废弃了, 官方建议从 TypeScript 2.0 开始, 使用DefinitelyTyped. 安装使用
1 | npm install --save-dev @types/node |
创建TYPESCRIPT配置文件TSCONFIG.JSON
1 | tsc --init |
更多esconfig.json
配置参数见官网完整的编译器选项列表
创建.TS/.TSX文件编译并运行
1 | tsc |
- 本文作者: 醉疏狂
- 本文链接: https://hubin97.github.io/2022/06/15/RN项目配置相关/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!