Javascript 使用grunt ts编译typescript不使用定义文件
当我使用“tsc.exe”构建项目时,它编译得很好 我正在尝试编译此typescript文件: chrome.history.search(null,(historyItems)=>{ }); 我使用Javascript 使用grunt ts编译typescript不使用定义文件,javascript,typescript,gruntjs,grunt-ts,Javascript,Typescript,Gruntjs,Grunt Ts,当我使用“tsc.exe”构建项目时,它编译得很好 我正在尝试编译此typescript文件: chrome.history.search(null,(historyItems)=>{ }); 我使用npm install@types/chrome添加了chrome定义文件。 它使用tsc.exe构建,甚至可以被VSCode正确识别,但当我尝试使用Grunt和Grunt ts构建它时,它当前失败,出现以下错误: $ grunt build
npm install@types/chrome
添加了chrome定义文件。
它使用tsc.exe
构建,甚至可以被VSCode正确识别,但当我尝试使用Grunt和Grunt ts
构建它时,它当前失败,出现以下错误:
$ grunt build
Running "ts:deafult" (ts) task
Compiling...
Fast compile will not work when --out is specified. Ignoring fast compilation
Using tsc v1.6.2
app/src/historian.ts(1,1): error TS2304: Cannot find name 'chrome'.
>> 1 non-emit-preventing type warning
>> Error: tsc return code: 2
Warning: Task "ts:deafult" failed. Use --force to continue.
Aborted due to warnings.
error Command failed with exit code 3.
我的.Gruntfile
:
ts: {
default: {
files: {'dist/out.js': ['app/src/history.ts'},
options: {
sourceMap: true,
moduleResolution: "node"
}
}
},
我还尝试了包括三个斜杠指令和import
语句