Suggestion
π Search Terms
build mode, declarations, d.ts
β
Viability Checklist
My suggestion meets these guidelines:
β Suggestion
It would be great tsconfig.json can expose a set of keys to say, "these are the only types that will be exported" from this module, and don't generate .d.ts for the rest.
π Motivating Example
When building under --build, TSC emits .d.ts for every single TS file in the module, but intuitively it only needs to
generate declaration files for the ones that's cross module boundary (so that other modules when referencing it),
which is likely a very small subset of types defined in the entire module.
π» Use Cases
We have this problem where trying to switch build mode, TSC generates huge type declarations for files who are not
even referenced by other modules at all. The emit time is extremely high and incremental build is barely usable.
Sometimes it's not even possible to build-ify a project, if I have a module that,
export const thirdPartyLib = await import("3rd-party")
If this thirdPartyLib export a type that exposes an unimported type in its shape, we'll hit this error
error TS4023: Exported variable 'deps' has or is using name 'ElementsProps' from external module "node_modules/@stripe/react-stripe-js/dist/react-stripe" but cannot be named.
Concrete example: https://github.com/stripe/react-stripe-js/blob/master/src/components/Elements.tsx#L72
Suggestion
π Search Terms
build mode, declarations, d.ts
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
It would be great tsconfig.json can expose a set of keys to say, "these are the only types that will be exported" from this module, and don't generate .d.ts for the rest.
π Motivating Example
When building under
--build, TSC emits.d.tsfor every single TS file in the module, but intuitively it only needs togenerate declaration files for the ones that's cross module boundary (so that other modules when referencing it),
which is likely a very small subset of types defined in the entire module.
π» Use Cases
We have this problem where trying to switch build mode, TSC generates huge type declarations for files who are not
even referenced by other modules at all. The emit time is extremely high and incremental build is barely usable.
Sometimes it's not even possible to build-ify a project, if I have a module that,
If this
thirdPartyLibexport a type that exposes an unimported type in its shape, we'll hit this errorConcrete example: https://github.com/stripe/react-stripe-js/blob/master/src/components/Elements.tsx#L72