- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 330
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 #534
Comments
Please provide a minimal reproduction example, a simple TS project that exhibits this issue with clear npm-based install and build steps. You should narrow the types of the payload properties you access or at the very least type assert them. |
I'll revert for now but please do come back with the reproduction. |
Sure, am just currently busy and wanted to get that possible regression reported as quick as possible :) will setup a minimal repro in the coming days if still necessary by then 🤞 |
It is necessary because I want to re-introduce the PR eventually. |
Feel free to come back with a repro on your own time. I'll close this for now. |
I always expected me to do this on my own time. Leaving that part out of the invitation to come back with a reproduction would keep the message and sound less harsh 😄 |
Didn't mean to sound harsh, and even re-reading it still doesn't sound like so to me. What I meant is, feel free to come back with a repro anytime not being pressured by an open issue that's waiting on you, that's all :) |
The issue is in the following section: Lines 94 to 97 in f079ca3
There is a loop between JsonValue and JsonObject. |
Based on https://stackoverflow.com/a/50516408/4682621 it might be a solution to define type JsonObject<T> = {
[K in keyof T]?: T[K] extends object ? JsonObject<T[K]> :
T[K] extends JsonPrimitive | JsonArray ? T[K] : never
} But I'm not that kind of typescript pro, so please validate that suggestion thoroughly! |
Curcular referencing is not an issue and I've had this code in other projects for a long time with no issues. That's why I need a minimal reproduction, to be able to rule out that this isn't a problem caused by something else in your stack. From the looks of it in your screenshot it is. |
What happened?
Updated from v4.14.1 to v4.14.2: maevsi/vibetype#1215

Now there seems to be a loop in the typescript types:
Version
4.14.2
Runtime
Node.js
Runtime Details
typescript 5.0.4
Code to reproduce
https://github.com/maevsi/maevsi/actions/runs/4817158729/jobs/8577533577?pr=1215#step:7:1785
Required
The text was updated successfully, but these errors were encountered: