microsoft / microsoft/TypeScript
Type Instantiation is Excessively Deep Error Regression in #37348
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
🔎 Search Terms
type instantiation is excessively deep, unused type parameter, unused tuple element, #37348
🕗 Version & Regression Information
This changed in PR #37348
⏯ Playground Link
💻 Code
declare class _InternalTypeDataModel {
prepareDerivedData: [any, any];
};
declare class TypeDataModel<
// If this type parameter is deleted the circularity goes away.
Unused,
DerivedData,
> extends _InternalTypeDataModel {
prepareDerivedData: this extends TypeDataModel<any, infer DerivedData>
? // This second element in the tuple is also necessary for some reason.
[this, any]
: any;
}
🙁 Actual behavior
Type instantiation is excessively deep and possibly infinite.
🙂 Expected behavior
No error.
Additional information about the issue
I understand the weirdness in this minimized code but the actual code I was reducing actually does useful things and doesn't really seem so contrived in context. In actual code all type parameters and tuple elements actually do useful things but this reproduction shows it doesn't matter if they're used, just that they exist, for some reason.
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
Start with the provided Playground reproduction and compare its behavior with the change introduced by PR #37348. Trace the type-instantiation path responsible for the excessive-depth diagnostic, then verify that this example and the reported regression no longer produce an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100