Reputation: 335
I downloaded a sample .NET MVC app which included Angular2-final. The project has a typings.json at the root and a tsconfig.json in the ng2 app dir. What is the relationship between these 2 files? Does this represent the latest and greatest way to configure TypeScript in VS? Is typings.json required or can tsconfig.json be configured to cover the functionality in typings.json? Here's the tsconfig.json:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../Scripts/",
"removeComments": false,
"sourceMap": true,
"target": "es5",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts"
]
}
Here's the typings.json:
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160725163759",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160909174046"
}
}
Upvotes: 1
Views: 661
Reputation: 53
Typings is a type definition manager for typescript: https://github.com/typings/typings
It uses the typings.json file similarly to how npm uses the package.json file, storing what type definitions are needed for the project.
tsconfig.json is the typescript configuration file and stores configuration for the typescript compiler.
You do not need to use typings, and can use the @types organization on npmjs.org to get type definitions: https://www.npmjs.com/~types. Install with npm like this:
npm install --save-dev @types/<module name>
Then add the following to your tsconfig.json:
"typeRoots": [
"../node_modules/@types"
]
Upvotes: 2