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

Adds support and test for ReadonlyArray #88

Merged
merged 1 commit into from Jul 26, 2022

Conversation

dpeek
Copy link
Contributor

@dpeek dpeek commented Jul 14, 2022

Currently a type with a ReadonlyArray field results in a circular dependency error.

type Superman = {
   weaknesses: ReadonlyArray<string>;
}

This PR adds support for ReadonlyArray by treating is as a normal zod array type, and adds a test to verify it works.

While testing I had to upgrade ts-node as I was getting this error:
https://stackoverflow.com/questions/72488958/false-expression-non-string-value-passed-to-ts-resolvetypereferencedirective

Happy to revert that bit if you don't want to upgrade that dependency :)

@codecov-commenter
Copy link

Codecov Report

Merging #88 (ef0341c) into main (e5e4961) will decrease coverage by 1.33%.
The diff coverage is 96.27%.

@@            Coverage Diff             @@
##             main      #88      +/-   ##
==========================================
- Coverage   98.49%   97.15%   -1.34%     
==========================================
  Files           8       12       +4     
  Lines         332      457     +125     
  Branches      102      159      +57     
==========================================
+ Hits          327      444     +117     
- Misses          5       11       +6     
- Partials        0        2       +2     
Impacted Files Coverage Δ
src/core/generateZodSchema.ts 95.07% <92.30%> (-2.13%) ⬇️
src/utils/resolveModules.ts 97.67% <97.67%> (ø)
src/core/generate.ts 100.00% <100.00%> (ø)
src/core/jsDocTags.ts 98.57% <100.00%> (-1.43%) ⬇️
src/core/validateGeneratedTypes.ts 97.05% <100.00%> (-0.31%) ⬇️
src/utils/getSimplifiedJsDocTags.ts 100.00% <100.00%> (ø)
src/utils/isNotNull.ts 100.00% <100.00%> (ø)
src/utils/resolveDefaultProperties.ts 100.00% <100.00%> (ø)
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

Copy link
Owner

@fabien0102 fabien0102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks for the contribution 💯

@fabien0102 fabien0102 merged commit 513ebf9 into fabien0102:main Jul 26, 2022
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.

None yet

3 participants