How do i get declare module to work in Node, I get the typescript to compile without errors and the Intellisense in VS.Code works. But i get "Cannot find module 'messages'" in runtime.
Clarification : I´m trying to get both the api.ts and mq.ts classes under the same "namespace" messages.
I have the following node project setup.
- /messages/api.ts
- /messages/mq.ts
- /main.ts
api.ts
declare module "messages" {
export class Put {
}
}
mq.ts
declare module "messages"{
export class GetWork {
}
}
main.ts
import * as messages from "messages";
let x = new messages.GetWork();
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs"
},
"exclude": [ ]
}
jsconfig.json
{
"compilerOptions": {
"target": "ES6"
}
}