atjeff
atjeff

Reputation: 13

How do I use typescript definition files (.d.ts) in a angularjs application without reference path?

I want to use .d.ts files for intellisense in javascript using VScode. For example, I have an angular js file comments.js, In this file, I want to use the type definitions from utilities.d.ts which exports a namespace "Utilities".

So typing Utilties. would trigger intellisense for the methods in utilities.d.ts.

Is this possible in a javascript application without using reference path? /// ?

Upvotes: 1

Views: 4158

Answers (1)

Sefe
Sefe

Reputation: 14017

You can create a separate folder for your typings and reference them in the tsconfig.json file:

{
    "include": [
        "src/typings/**/*.d.ts"
    ],
}

According to the official documentation you can also use the compilerOptions/typeRoots section, but I use include to reference my typings and it works fine.

Upvotes: 3

Related Questions