Reputation: 1451
I have a TypeScript project that is used in Node.js, and I have decided to add type definitions so that IntelliSense can pick it up in Visual Studio Code. On my tsconfig.json
, I have enabled definitions to be produced alongside the compiled JS, but I don't know what other setup I need to make it so that when my project is downloaded using npm, the types appear on IntelliSense without any other setup. Anyone have any idea how this can be done? My tsconfig.json
file:
{
"compilerOptions": {
"target": "es5",
"lib":["es2016","es2016.array.include","dom"],
"noImplicitAny":false,
"noEmitOnError":true,
"removeComments": true,
"declaration": true
},
"include": [
"src/ts/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
Upvotes: 2
Views: 1407
Reputation: 176
Set the types
property in your package.json
file to point to your definitions file, like this (assuming your declarations are in src/ts/main.d.ts
):
{
"types": "./src/ts/main.d.ts"
}
See TypeScript docs for details.
Upvotes: 1