microsoft / microsoft/TypeScript
Idea: Can declaration emit synthesize type aliases?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Object types can be very large and in (e.g.) a react project that makes heavy use of type inference, it's not uncommon to have to refer to a type that is either not imported or is simply anonymous (e.g. a props type). When these appear in multiple places in a declaration file, they tend to expand it considerably. Perhaps we could just synthesize type aliases for them?
- We'd have to be careful not to change the exported API shape
- We could use a heuristic to skip the work for small types (e.g. < 20 characters)
- Even if we didn't wait until the second use of a type to decide to extract it, we'd be adding ~4 tokens per type (
type id =andidat the use site)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue proposes synthesizing type aliases during declaration emit for repeated large anonymous object types. No files, tests, or entry points are named; first map the declaration-emit implementation and evaluate the stated size heuristic. Done means reducing declaration-file expansion without changing the exported API shape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100