Having compiled my TypeScript project successfully, I intended to run it in VS Code's debug mode using ts-node. Problem is, ts-node can't find d.ts files I created (while tsc has no problem with it).
Project structure is:
/ conf/ dist/ src/ types/ package.json tsconfig.json tsconfig.json relevant entries are:
{ "compilerOptions": { "target": "es2017", "module": "commonjs", // "lib": [], "sourceMap": true, "outDir": "dist", "rootDir": "src", "moduleResolution": "node", "baseUrl": ".", "paths": { "*": [ "node_modules/*", "src/types/*" ] }, // "rootDirs": [], // "typeRoots": [], // "types": [], }, "include": [ "src/**/*" ] } The definition file ts-node can't find is src/types/global.d.ts:
import { App } from '../App'; declare global { namespace NodeJS { interface Global { app: App; } } } So, trying to run it with ts-node I see:
TSError: ⨯ Unable to compile TypeScript: src/boot.ts(15,59): error TS2339: Property 'app' does not exist on type 'Global'. How to resolve it globally? I've found that /// <reference path="./types/global.d.ts" /> does the trick but I'd have to repeat it in every file using global.app.
My TypeScript version is 3.0.1