glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
12.12k stars 1.06k forks source link

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

Closed kriswest closed 11 months ago

kriswest commented 11 months ago

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 commented 11 months ago

doh! forked the wrong repo. Will reopen PR from a new fork.