Microsoft/TypeScript
Ver no GitHubType Instantiation is Excessively Deep Error Regression in #37348
Open
#60.567 aberto em 23 de nov. de 2024
BugDomain: check: Type CircularityHelp Wanted
Métricas do repositório
- Stars
- (48.455 stars)
- Métricas de merge de PR
- (Mesclagem média 6d 17h) (9 fundiu PRs em 30d)
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.