FormidableLabs / FormidableLabs/ts-simplify

Allow providing a list of non-expandable types

Open
#10 0 comments 1 reaction 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.