FormidableLabs / FormidableLabs/ts-simplify
Allow providing a list of non-expandable types
- Dominant language
- TypeScript
- Stars
- 20
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
### Feature Request
Problem: Every type gets expanded which implies you will need to recompile your types if built-in typescript declaration files change. For example, if a new method is added to Set, Array, Promise, etc. your users wouldn't be able to see it until you re-compile your types and they update their deps.
I would like to be able to provide a list of non-expandable types via a `--preserve` command line argument.
The basic usage would be `ts-simplify ./example-types.ts ./example-types.d.ts --preserve`. That would preserve all types declared in https://github.com/microsoft/TypeScript/blob/main/src/lib/esnext.d.ts.
Users would be able to pick just a subset of builtin declaration files like `ts-simplify ./example-types.ts ./example-types.d.ts --preserve es2023`. That would preserve only types declared within https://github.com/microsoft/TypeScript/blob/main/src/lib/es2023.d.ts.
A --no-preserve command line argument could be also added to you could specify `--preserve` and then exclude some builtin files via `--no-preserve`
The user would be able to add custom declaration files to preserve like `ts-simplify ./example-types.ts ./example-types.d.ts --preserve builtins ./my_global_types.d.ts`
builtins is an alias for typescript builtin types just in case some user only wants to preserve their own types.
Contributor guide
Assessment
This issue has not been assessed yet.