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

Add support for Joi.any().cast() to string and number types #142

Merged
merged 8 commits into from
Sep 9, 2021

Conversation

kjb085
Copy link
Contributor

@kjb085 kjb085 commented Sep 1, 2021

Currently any use of Joi.any().cast() fails. It supports converting to string, number, Map, and Set - given that handling the generics for Map and Set adds some additional complexities, I've added the base level of support for string and number types.

src/parse.ts Outdated Show resolved Hide resolved
@mrjono1
Copy link
Owner

mrjono1 commented Sep 1, 2021

Thankyou for the PR! I'll review it soon

Copy link
Owner

@mrjono1 mrjono1 left a comment

Choose a reason for hiding this comment

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

This should be enough to resolve the TS issues

src/joiDescribeTypes.ts Outdated Show resolved Hide resolved
src/parse.ts Outdated Show resolved Hide resolved
src/parse.ts Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 4, 2021

Codecov Report

Merging #142 (acc1934) into master (8b68919) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
+ Coverage   97.82%   97.84%   +0.01%     
==========================================
  Files           8        8              
  Lines         414      417       +3     
  Branches      134      136       +2     
==========================================
+ Hits          405      408       +3     
  Misses          9        9              
Impacted Files Coverage Δ
src/index.ts 100.00% <ø> (ø)
src/parse.ts 96.20% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b68919...acc1934. Read the comment docs.

src/index.ts Show resolved Hide resolved
@mrjono1
Copy link
Owner

mrjono1 commented Sep 8, 2021

looks good me ready to merge?

@kjb085
Copy link
Contributor Author

kjb085 commented Sep 8, 2021

@mrjono1 - All set. I somehow missed actually updating the README, but I've now added the cast function noting support for string and number under "Joi Features Supported" section

@mrjono1 mrjono1 merged commit 56a3d28 into mrjono1:master Sep 9, 2021
@mrjono1
Copy link
Owner

mrjono1 commented Sep 9, 2021

@kjb085 thankyou, this has been released under https://github.com/mrjono1/joi-to-typescript/releases/tag/2.2.0

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.

2 participants