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

style: fix misspelled constraint word #304

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Here is an example how you can do async validation with zod:
import { refine } from '@conform-to/react';

// Instead of reusing a schema, let's prepare a schema creator
function createSchema(options?: {
function createSchema(constraint?: {
isEmailUnique?: (email) => Promise<boolean>;
}) {
return z.object({
Expand All @@ -114,7 +114,7 @@ function createSchema(options?: {
z.string().superRefine((email, ctx) =>
// Using the `refine` helper from Conform
refine(ctx, {
validate: () => constarint.isEmailUnique?.(email),
validate: () => constraint.isEmailUnique?.(email),
message: 'Username is already used',
}),
),
Expand Down Expand Up @@ -177,7 +177,7 @@ function createSchema(
.pipe(
z.string().superRefine((email, ctx) =>
refine(ctx, {
validate: () => constarint.isEmailUnique?.(email),
validate: () => constraint.isEmailUnique?.(email),
// Check only when it is validating the email field or submitting
when: intent === 'submit' || intent === 'validate/email',
message: 'Username is already used',
Expand Down
4 changes: 2 additions & 2 deletions examples/react-router/src/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { z } from 'zod';
// Instead of sharing a schema, prepare a schema creator
function createSchema(
intent: string,
constarint: {
constraint: {
// isUsernameUnique is only defined on the server
isUsernameUnique?: (username: string) => Promise<boolean>;
} = {},
Expand All @@ -25,7 +25,7 @@ function createSchema(
.pipe(
z.string().superRefine((username, ctx) =>
refine(ctx, {
validate: () => constarint.isUsernameUnique?.(username),
validate: () => constraint.isUsernameUnique?.(username),
when: intent === 'submit' || intent === 'validate/username',
message: 'Username is already used',
}),
Expand Down
4 changes: 2 additions & 2 deletions examples/remix/app/routes/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { z } from 'zod';
// Instead of sharing a schema, prepare a schema creator
function createSchema(
intent: string,
constarint: {
constraint: {
// isUsernameUnique is only defined on the server
isUsernameUnique?: (username: string) => Promise<boolean>;
} = {},
Expand All @@ -25,7 +25,7 @@ function createSchema(
.pipe(
z.string().superRefine((username, ctx) =>
refine(ctx, {
validate: () => constarint.isUsernameUnique?.(username),
validate: () => constraint.isUsernameUnique?.(username),
when: intent === 'submit' || intent === 'validate/username',
message: 'Username is already used',
}),
Expand Down
Loading