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

fix: Typescript zod (and effect) language uses block scoped variables before they've been declared #2419

Merged
merged 5 commits into from
Feb 14, 2024

Conversation

kriswest
Copy link
Contributor

@kriswest kriswest commented Oct 2, 2023

By ensuring that referenced types are defined before they are referenced. Tested on a fairly large set of interconnected schemas for the bridging API in the FDC3 standard.

Please let me know if there's a more idiomatic way to get to the types underlying sets, unions, intersections, arrays etc..

resolves #2414

@ryoid @Southclaws @dvdsgl
P.S. The TypeScript effect schema language uses the same code in its generation and probably also needs these changes - I don't have a test set-up for that one however.

@kriswest
Copy link
Contributor Author

kriswest commented Jan 3, 2024

@ryoid @Southclaws @dvdsgl any chance of a review on this PR? I believe it straightens out issues with generated typescript zod code in the current release.

@dvdsgl
Copy link
Member

dvdsgl commented Jan 3, 2024

Yep! Will review next weekend.

@kriswest
Copy link
Contributor Author

kriswest commented Jan 3, 2024

Much appreciated @dvdsgl

kriswest and others added 2 commits January 3, 2024 17:16
adding a warning to Typescript Zod generator on (unlikely) exceeeding max num passes when determining output order + correcting a comment typo
@dvdsgl
Copy link
Member

dvdsgl commented Feb 14, 2024

I’m pretty sure the type graph already provides this for other languages where declaration order matters, although I am not sure where that functionality is. I think we can still merge this however, and replace it if there’s a built-in way to do it.

@dvdsgl dvdsgl merged commit cab3d94 into glideapps:master Feb 14, 2024
46 checks passed
@dvdsgl
Copy link
Member

dvdsgl commented Feb 14, 2024

Thank you!

@kriswest
Copy link
Contributor Author

🎉

I’m pretty sure the type graph already provides this for other languages where declaration order matters, although I am not sure where that functionality is. I think we can still merge this however, and replace it if there’s a built-in way to do it.

I did wonder if that was the case - but couldn't figure it out. If you come across the info let me know and I might be able to contribute a replacement using it one day.

@kriswest kriswest deleted the fix-zod-code-generation branch February 14, 2024 15:07
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

Successfully merging this pull request may close these issues.

Typescript zod (and effect) language uses block scoped variables before they've been declared
2 participants