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 and possibly infinite." error when upgrading from 4.4.4 to 4.5.2 #46848

Closed
sinbino opened this issue Nov 18, 2021 · 2 comments

Comments

@sinbino
Copy link

sinbino commented Nov 18, 2021

Bug Report

🔎 Search Terms

  • Type instantiation is excessively deep and possibly infinite

🕗 Version & Regression Information

When compiling the source that imports the @sinclair/typebox package using tsc 4.5.2

import { Static, Type } from '@sinclair/typebox'

The following error will occur.

node_modules/@sinclair/typebox/typebox.d.ts:239:104 - error TS2589: Type instantiation is excessively deep and possibly infinite.

239 export declare type StaticConstructor<T extends readonly TSchema[], U extends TSchema> = new (...args: [...{
                                                                                                           ~~~~~
240     [K in keyof T]: Static<T[K]>;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241 }]) => Static<U>;
    ~~

Compiling the same code with tsc 4.4.4 succeeds.
There have been a few reports of similar issues, but this is the difference between 4.4.4 and 4.5.2. It could be a different problem.

https://unpkg.com/@sinclair/[email protected]/typebox.d.ts
Probably, tsc 4.4.4 interprets this type definition file correctly, but tsc 4.5.2 does not.

⏯ Playground Link

No tsc 4.5.2 in playground.

💻 Code

import { Static, Type } from '@sinclair/typebox'

Just import it.

🙁 Actual behavior

In tsc 4.5.2 (and 4.6.0-dev.20211117), receive the error "Type instantiation is excessively deep and possibly infinite.

🙂 Expected behavior

tsc 4.5.2 should compile as successfully as tsc 4.4.4.

@gudleik
Copy link

gudleik commented Nov 18, 2021

This has been fixed in typebox: sinclairzx81/typebox#119

@sinbino
Copy link
Author

sinbino commented Nov 18, 2021

@gudleik
Thanks for telling me!

@sinbino sinbino closed this as completed Nov 18, 2021
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

2 participants