Skip to content

Commit

Permalink
docs: fix misspelled constraint word (#304)
Browse files Browse the repository at this point in the history
Co-authored-by: Edmund Hung <[email protected]>
  • Loading branch information
sylvainDNS and edmundhung authored Oct 17, 2023
1 parent ffc7788 commit 56d1ab6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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

0 comments on commit 56d1ab6

Please sign in to comment.