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

feat: computed-types resolver #162

Merged
merged 4 commits into from
May 12, 2021
Merged

feat: computed-types resolver #162

merged 4 commits into from
May 12, 2021

Conversation

jorisre
Copy link
Member

@jorisre jorisre commented May 8, 2021

Welcome to the computed-types resolver ! 🎉
Related to #161

👀 :

  • Update repository dependencies
  • Only async mode for that new resolver
  • No criteriaMode: all because computed-types returns only the first error of each field
  • Basic type, always ValidationError :/ errors don't have a property such as a type, code or a key

@jorisre jorisre requested a review from bluebill1049 May 8, 2021 20:59
"birthYear": Object {
"message": "Expect value to be \\"number\\"",
"ref": undefined,
"type": "ValidationError",
Copy link
Member Author

@jorisre jorisre May 8, 2021

Choose a reason for hiding this comment

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

Always the same type, feel free to suggest a better way

path = '',
) => {
return (computedTypesError.errors || []).reduce((acc, error) => {
const _currentPath = String(error.path[0]);
Copy link
Member Author

Choose a reason for hiding this comment

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

path is always an array of one item

} from 'react-hook-form';

export type Resolver = (
schema: any,
Copy link
Member Author

Choose a reason for hiding this comment

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

Can't find a good way to type the schema.

@kotarella1110 if you want to play with that one, (no worries if you haven't time :))

@@ -4,7 +4,7 @@ import type {
ResolverResult,
UnpackNestedValue,
} from 'react-hook-form';
import type NopeObject from 'nope-validator/lib/cjs/NopeObject';
import type { NopeObject } from 'nope-validator/lib/cjs/NopeObject';
Copy link
Member Author

Choose a reason for hiding this comment

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

Nope V1 update

],
"publishConfig": {
"access": "public"
},
"scripts": {
"prepare": "run-s build:src build && check-export-map",
"prepare": "run-s build:src build && check-export-map && husky install",
Copy link
Member Author

Choose a reason for hiding this comment

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

Update to Husky v6

Copy link
Member

@bluebill1049 bluebill1049 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you @jorisre

@jorisre jorisre merged commit 85e5e7d into master May 12, 2021
@jorisre jorisre deleted the computed-types-resolver branch May 12, 2021 19:59
@github-actions
Copy link
Contributor

🎉 This PR is included in version 2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants