-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Invalid typescript generated when using circular types #370
Comments
@TimoGlastra thanks for the issue report. I don't see why we wouldn't be able to use the syntax that works. It should be fairly simple to implement. Cc: @mrlubos thoughts? |
@jordanshatford Feel free to change this, but leave a comment please explaining why we need that syntax |
@TimoGlastra I have a PR up using the Side note: both syntaxs act the same so this change is not breaking ( |
This does have a side effect which forced me to change existing code. When iterating over the keys, TypeScript sees the |
@jashaj could you create a new issue and provide examples of your code. For me the following is true:
I would need to see generated code to help with this issue (please under a newly created issue). Everywhere I have looked they are equivalent. |
Description
When using circular types (e.g. JsonObject where each value is JsonValue and JsonValue can in turn be a JsonObject) the generated typescript is invalid and won't compile.
The model generated is as follows:
However, TS supports circular references if you use this syntax:
Would it be possible to change the way records are typed, or could an exception be made for circular types (this may be hard to detect, so always using the first syntax might be simpler)
OpenAPI specification (optional)
Configuration
No response
System information (optional)
No response
The text was updated successfully, but these errors were encountered: