Reputation: 744
I have one main.ts script that I want to use as an entrypoint for my source code. This main.ts script require multiple others typescript files and export then right away :
export const Alpha = require('./Alpha.ts')
export const Beta = require('./Beta.ts')
I then used the typescript compiler to export the .d.ts declaration file of my source code. Now I have a main.d.ts file and two sub-scripts (Alpha.d.ts and Beta.d.ts).
If I create a single .js script and import my main.d.ts entrypoint. I see my two other scripts correctly. But my autocompletion can't follow what is inside the alpha and beta declaration files. I need to import them one by one to get what exported variables and function they have.
How can I access what is inside them by just importing my entrypoint ? I need to expose my source code declaration files without downloading the entire typescript source code.
Thank you for your help.
Upvotes: 0
Views: 47
Reputation:
I think it's:
export * as Alpha from "./Aplha.ts";
export * as Beta from "./Beta.ts"
Look at: https://www.typescriptlang.org/docs/handbook/modules.html#re-exports
You mixed CommonJS / Node.js modules with TypeScript (ES6)
Upvotes: 1