You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My intention is to bundle TypeScript definitions of TS code written by myself with definitions of external modules residing in node_modules. The reasoning behind is that I need to supply these joint definitions to a web-based TS code editor (MonacoEditor) to allow for code completion.
What I have working quite well:
Transpiling .ts to .js and bundling into a single .js file (note: I don't need the .js file; in the end I would turn on emitDeclarationOnly, but this isn't too relevant now). This is working for custom code, node-internal modules (such as 'path') and external modules (such as 'typeorm')
Transpiling .ts to .d.ts only for custom code
What isn't working yet:
Transpiling .ts to .d.ts for node-internal and external modules only references the modules but I would like to have them inlined in the same .d.ts file
Now is there any way how I can force rollup-plugin-ts to inline external type definitions as well?
For reference, I have created the following minimal repo, including the output .js and .d.ts: https://github.com/sumbricht/rollup_dts_example. In reality it would include definitions for around 100 external modules, therefore manually managing wouldn't be feasible; alternative automatable approaches are however also welcome :-).
{"compilerOptions": {/* Language and Environment */"target": "ESNext",/* Modules */"module": "ESNext","moduleResolution": "node","typeRoots": ["node_modules/@types"],"types": ["node"],/* Emit */"declaration": true,},"exclude": []}
entrypoint.ts:
// code by myself: nicely reflected in .js and .d.tsexport{Foo}from'./foo'// node-internal code: nicely reflected in .js but as external reference in .d.tsexport{dirname}from'path'// external module: nicely reflected in .js but as external reference in .d.tsexport{createConnection}from'typeorm'
entrypoint.js:
classFoo{foo;constructor(foo){this.foo=foo;}printFoo(){console.log(this.foo);}}// code from 'path' and 'typeorm' (cut for brevity)export{Foo,createConnection$1ascreateConnection,dirname};
Question
My intention is to bundle TypeScript definitions of TS code written by myself with definitions of external modules residing in node_modules. The reasoning behind is that I need to supply these joint definitions to a web-based TS code editor (MonacoEditor) to allow for code completion.
What I have working quite well:
What isn't working yet:
Now is there any way how I can force rollup-plugin-ts to inline external type definitions as well?
For reference, I have created the following minimal repo, including the output .js and .d.ts: https://github.com/sumbricht/rollup_dts_example. In reality it would include definitions for around 100 external modules, therefore manually managing wouldn't be feasible; alternative automatable approaches are however also welcome :-).
Below the main files:
rollup.config.js:
tsconfig.json:
entrypoint.ts:
entrypoint.js:
entrypoint.d.ts:
The text was updated successfully, but these errors were encountered: