使用TS2.0Beta,我不能让新的@types工作。在我的代码中的某处:
import * as angular from 'angular';TS 2.0 @types:
npm install --save @types/angular
tsc编译器找不到d.ts文件:错误:(1,26) TS2307:找不到模块'angular‘。
当前(旧)使用类型工具和全局(环境之前)依赖关系的方法没有问题。
我希望d.ts查找能够在2.0中自动工作,如下所述:
https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/
也许我错过了什么?
发布于 2016-07-23 05:30:39
我在另一个文件中也遇到了同样的问题-- tsc找不到node_modules/@types/es6-shim。显式地将类型添加到tsconfig.json有助于:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmit": true,
"types":["es6-shim"],
"sourceMap": true,
"target": "es5"
}
}https://stackoverflow.com/questions/38347734
复制相似问题