Forgive me if I misunderstand, but I thought that if I used a tsconfig.json
file at my project root, then I would no longer need to use any ///<reference path="..." />
tags in order to make my code compile. Am I wrong?
For example, I'm using AngularJS. My App.ts
file looks something like this:
import SomeModule from './whatever/SomeModule';
angular.module('foo', [SomeModule.name]).run(...);
My tsconfig.json
file looks (in part) like this:
{
"compileOnSave": false,
"compilerOptions": {
"target": "es5",
"module": "commonjs"
},
"filesGlob": [
"./www/**/*.ts",
"./typings/**/*.ts"
],
"files": [
/* a bunch of files omitted for brevity*/
"./typings/angularjs/angular.d.ts"
],
}
Notice that I have listed in my files array the path to the angular definition file. Also notice that I have the compileOnSave
option set to false. Eventually I would like to use Browserify to compile and bundle all the code. But for now I just want to see if I can get it to compile with tsc
.
But when I run tsc App.ts
, I get an error that says "Cannot find name 'angular'." How do I make the TypeScript compile use the angular.d.ts
file when compiling the code?
Running
tsc App.ts
won't work because a file is being specified. Follow the instructions from the documentation: