-
Notifications
You must be signed in to change notification settings - Fork 5
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
Recursive interface declaration #26
Comments
Sorry, missed your issue. |
Had the same problem before: try this circular Replacer |
Hey, everyone. I know this problem is very old, but I want to solve it because I think recursive types are quite common, especially in GraphQL applications. @InsOpDe I tested the library you mentioned for a moment and I could see that it resolves a cyclic object. However, we need to take a step back and think about how to declare the reflected type using TypeScript factories in compile/transpile mode. Personally, it's more complex to go the JSONPath way because I think it requires a big change to the codebase. But I can imagine a solution based on the OpenAPI's components schema using {
"root": {
"$ref": "#/StatsModel"
},
"types": {
"#/StatsModel": {
"kind": 19,
"name": "StatsModel",
"properties": {
"a": {
"kind": 19,
"modifiers": 0,
"$ref": "#/StatsModel"
}
}
}
}
} What do you think? CC: @goloveychuk |
We have 3 options
2 makes most sense, it's a standard and you can use ecosystem of libs, eg ajv. But then you will need to emit all types from project in one files, so you won't have duplicates if type is referencing other reflected type. But that's a big change and a lot of work. |
That file will be "storage" |
How this schema will be "storage"? Last week I tried to create a new SourceFile and import/require it while the code is built, but without success. |
Nice tool!
However
results in
The text was updated successfully, but these errors were encountered: