Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用grunt ts编译typescript不使用定义文件_Javascript_Typescript_Gruntjs_Grunt Ts - Fatal编程技术网

Javascript 使用grunt ts编译typescript不使用定义文件

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

当我使用“tsc.exe”构建项目时,它编译得很好

我正在尝试编译此typescript文件: chrome.history.search(null,(historyItems)=>{ });

我使用
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
语句