dts-generator
dts-generator copied to clipboard
Hide private classes
Is there any way to hide private classes? I would like dts-generator only generate declarations based on index.ts exports, and I don't want my users to see private classes.
Not that I'm aware of, but it would be a welcomed improvement.
Do you mean some kind of "tree shaking"? In terms of exported types, only the exported types of the given input files, plus all recursively reachable types from those top-level types should be included in output. This is different from considering all exported types from all (recursively) imported modules.
That would be a really great feature! I bundle my package (with esbuild) and have a facade file which exports only those types needed for external users - the public api. Everything else is not reachable anyway via the bundle. The d.ts file should reflect this.
Set up a demo repo which shows the issue: https://github.com/manwithafox/demo-dts-facade
- [severe] generated d.ts does NOT contain module
address.ts
: https://github.com/manwithafox/demo-dts-facade/blob/96a226fa41e306c2f5f319ef446b3817b116cae6/foo.d.ts#L2 - [above feature request]
- generated d.ts contains
class B
https://github.com/manwithafox/demo-dts-facade/blob/96a226fa41e306c2f5f319ef446b3817b116cae6/foo.d.ts#L8-L10 even it is not reachable viafacade.ts
- private field
age
should be excluded: https://github.com/manwithafox/demo-dts-facade/blob/96a226fa41e306c2f5f319ef446b3817b116cae6/foo.d.ts#L6
- generated d.ts contains