1

When I build the project using "tsc.exe" it compiles fine.

I'm attempting to compile this typescript file: chrome.history.search(null, (historyItems) => { });

I added the chrome definition files using npm install @types/chrome. It builds using tsc.exe and is even recognized correctly by VSCode, but when I try to build it using Grunt and grunt-ts it current fails with the following error:

$ 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.                                           

My .Gruntfile:

ts: {
    default: {
        files: {'dist/out.js': ['app/src/history.ts'},
            options: {
                sourceMap: true,
                moduleResolution: "node"
            }
        }
    },

I've also tried including the triple-slash directives and import statements.

chustar
  • 12,225
  • 24
  • 81
  • 119

0 Answers0