Node.js tsc报告错误TS2318:找不到全局类型';布尔值';
我是节点和类型脚本的新手,在编译我的类型脚本项目时遇到了麻烦。我已经读了很多这样的帖子,但仍然不能解决我的问题 有人能帮我吗 tsconfig.json: 打字/索引d.ts: 我尝试将tsconfig.json中的“noLib”选项设置为true。这将导致另一个错误:Node.js tsc报告错误TS2318:找不到全局类型';布尔值';,node.js,typescript1.8,typescript-typings,tsc,Node.js,Typescript1.8,Typescript Typings,Tsc,我是节点和类型脚本的新手,在编译我的类型脚本项目时遇到了麻烦。我已经读了很多这样的帖子,但仍然不能解决我的问题 有人能帮我吗 tsconfig.json: 打字/索引d.ts: 我尝试将tsconfig.json中的“noLib”选项设置为true。这将导致另一个错误: > pats-test-report-client@1.0.0 compile C:\WorkSpace\WeiHao\Git\dev-pats-test-report\server > typings instal
> pats-test-report-client@1.0.0 compile C:\WorkSpace\WeiHao\Git\dev-pats-test-report\server
> typings install && tsc && concurrently
├── angular-protractor (global)
├── core-js (global)
├── jasmine (global)
├── koa (global)
├── node (global)
├── require (global)
├── selenium-webdriver (global)
├── sequelize (global)
└── typescript (global)
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'TemplateStringsArray'.
我理解当noLib设置为false时报告错误TS2300的原因。但不知道当noLib设置为true时为什么会报告错误TS2318。可能是您的tsconfig.json中缺少es2015。编辑如下:
{
"compilerOptions": {
...
"lib": ["es2015"]
...
}
}
我在nodejs上执行typescript时出现了这个错误。要修复此问题,我必须为NodeJ安装类型依赖项:
npm i @types/node
> pats-test-report-client@1.0.0 compile C:\WorkSpace\WeiHao\Git\dev-pats-test-report\server
> typings install && tsc && concurrently
├── angular-protractor (global)
├── core-js (global)
├── jasmine (global)
├── koa (global)
├── node (global)
├── require (global)
├── selenium-webdriver (global)
├── sequelize (global)
└── typescript (global)
error TS2318: Cannot find global type 'Boolean'.
error TS2318: Cannot find global type 'IArguments'.
error TS2318: Cannot find global type 'TemplateStringsArray'.
{
"compilerOptions": {
...
"lib": ["es2015"]
...
}
}
npm i @types/node