Go to the TypeScript source file instead of the type definition file in VS Code

Since Typescript 2.9 it is possible to compile your library with the declarationMap flag

./node_modules/typescript/bin/tsc -p . --declarationMap

Doing so creates a declaration map file (dist/ActionApi.d.ts.map) and a link to the map at the bottom of the corresponding d.ts file

//# sourceMappingURL=ActionApi.d.ts.map

When VSCodes encounters such a declarationMap it knows where to go to and leads you directly to the source code.

Leave a Comment