Microsoft/TypeScript
在 GitHub 查看Type Instantiation is Excessively Deep Error Regression in #37348
Open
#60,567 建立於 2024年11月23日
BugDomain: check: Type CircularityHelp Wanted
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
🔎 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.