VS Code Typescript IntelliSense does not suggest namespace from global.d.ts

229 views Asked by At

If I declare the namespace globally for an application, I can use it (it works without compilation errors), but I won't have suggestion/autocompletion for the namespace specifically. However types from this namespace do appear in the intellisense suggestions.

In other words, while I type the namespace (for example libTypes) there are no suggestions for it, but after I finish typing the namespace and add a dot after it (libTypes.) intellisense starts suggesting me all the available types in this namespace.

Example of global.d.ts
import * as _libTypes from 'library/types';
declare global {
    const libTypes: typeof _libTypes;
}

export as namespace libTypes;
export = _libTypes;
tsconfig.json
{
  "files": [
    "src/main.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}
1

There are 1 answers

0
Rui On

Change the tsconfig.json like this

tsconfig.json

{
  "files": [
    "src/main.ts"
  ],
  "include": [
    "src/**/*.d.ts",
    "types"
  ]
}