Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Instantiation is Excessively Deep Error Regression in #37348 #60567

Open
LukeAbby opened this issue Nov 23, 2024 · 0 comments
Open

Type Instantiation is Excessively Deep Error Regression in #37348 #60567

LukeAbby opened this issue Nov 23, 2024 · 0 comments

Comments

@LukeAbby
Copy link

LukeAbby commented Nov 23, 2024

πŸ”Ž Search Terms

type instantiation is excessively deep, unused type parameter, unused tuple element, #37348

πŸ•— Version & Regression Information

This changed in PR #37348

⏯ Playground Link

https://www.typescriptlang.org/play/?#code/CYUwxgNghgTiAEkoGdnwPoEkB2AXEM2UEAKgJ4AOIAIlLlALID2oE8A3gFDw-wVwVYNAgEsAbiGC16ALngBtKNjIAaeErIBdANycAvrs6gkcRNFTxyVaYxYgIAHm68A9C-iYAZvFwALEWi4lAiCMFAAtiD4MPAB8KxRkj6+CGAiMGAArtAwIkHwAOZMIGhQAO5QZAB0zjwAqtiZyJIqtfDUohJSdFCtAHzwIAAe+NjAaFh4BESkwTbMrBxt-CChwrldNnJ+ccOj45ZzPQv2DhpqItieBO2dkjZ9bbzwAPzwbpb+aM1gTGODEBAkTwsWwyQQuEyFEBsVKEGQTHg2HAJWQsDI8E8TBiCMi8DgKD+NWeJN48h2yDUGk0T14cg0uj0QA

πŸ’» 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant