Typescript declaration : how to include node_modules types?

85 Views Asked by At

I am trying to include types from node_modules into my .d.ts declaration file.

Currently what I get is this:

declare module "index" { import { Engine } from "@babylonjs/core/Engines/engine"; }

I would like to have all types from Engine declared without referencing an external file so that all my types are in a single file.

What should I change in my tsconfig?

{
  "compilerOptions": {
      "noImplicitAny": true,
      "target": "ES5",
      "module": "ES2015",
      "sourceMap": true,
      "moduleResolution":"node",
      "declaration": true,
      "emitDeclarationOnly": true,
      "skipLibCheck":true,
      "outDir": "dist",
      "outFile":"./dist/t.d.ts",
      "typeRoots": [
        "./node_modules/@types",
        "./node_modules/@babylonjs" //tried to add this without success
      ]
  },
  "include": ["src/index.ts"],
  "exclude": [],
}
0

There are 0 best solutions below