mirror of https://github.com/cupcakearmy/zod.git
fix typos
This commit is contained in:
parent
7fdfae12d0
commit
9edca8bb75
|
@ -91,7 +91,7 @@ module.exports = {
|
|||
{
|
||||
name: 'no-duplicate-dep-types',
|
||||
comment:
|
||||
"Likeley this module depends on an external ('npm') package that occurs more than once " +
|
||||
"Likely this module depends on an external ('npm') package that occurs more than once " +
|
||||
"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause " +
|
||||
"maintenance problems later on.",
|
||||
severity: 'warn',
|
||||
|
@ -140,7 +140,7 @@ module.exports = {
|
|||
"This module depends on an npm package that is declared as an optional dependency " +
|
||||
"in your package.json. As this makes sense in limited situations only, it's flagged here. " +
|
||||
"If you're using an optional dependency here by design - add an exception to your" +
|
||||
"depdency-cruiser configuration.",
|
||||
"dependency-cruiser configuration.",
|
||||
from: {},
|
||||
to: {
|
||||
dependencyTypes: [
|
||||
|
|
|
@ -106,7 +106,7 @@ try {
|
|||
names: ["Dave", 12], // 12 is not a string
|
||||
address: {
|
||||
line1: "123 Maple Ave",
|
||||
zipCode: 123, // zip code isnt 5 digits
|
||||
zipCode: 123, // zip code isn't 5 digits
|
||||
extra: "other stuff", // unrecognized key
|
||||
},
|
||||
});
|
||||
|
@ -327,7 +327,7 @@ err.flatten( (i: ZodIssue) => {
|
|||
```
|
||||
|
||||
- `fieldErrors` is an object. The keys are the field(s) that threw the error. The values are an array of error strings that can be easily presented in the interface.
|
||||
- `formErrors: string[]` is an array of errors that occured on the "root" of the object schema. For instance if you called `FormData.parse(null)`, `formErrors` would be:
|
||||
- `formErrors: string[]` is an array of errors that occurred on the "root" of the object schema. For instance if you called `FormData.parse(null)`, `formErrors` would be:
|
||||
```ts
|
||||
["Invalid input: expected object, received null"];
|
||||
```
|
||||
|
|
|
@ -40,7 +40,7 @@ Zod 2 is being retired and will not leave beta. This is due to some unintuitive
|
|||
|
||||
- The **minimum TypeScript version** is now _4.1_ (up from 3.7 for Zod 2). Several features have been rewritten to use [recursive conditional types](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#recursive-conditional-types), an incredibly powerful new feature introduced in TS4.1.
|
||||
|
||||
- **Transformers syntax**. Previously, creating a transformer required an input schema, an output schema, and a function to tranform between them. You created transformers like `z.transform(A, B, func)`, where `A` and `B` are Zod schemas. This is no longer the case. Accordingly:
|
||||
- **Transformers syntax**. Previously, creating a transformer required an input schema, an output schema, and a function to transform between them. You created transformers like `z.transform(A, B, func)`, where `A` and `B` are Zod schemas. This is no longer the case. Accordingly:
|
||||
|
||||
The old syntax is no longer available:
|
||||
|
||||
|
|
|
@ -1198,7 +1198,7 @@ myFunction; // (arg: string)=>number[]
|
|||
|
||||
## Preprocess
|
||||
|
||||
Typically Zod operates under a "parse, then tranform" paradigm. Zod validates the input first, then passes it through a chain of transformation functions. (For more information about transforms, read the [.transform docs](#transform).)
|
||||
Typically Zod operates under a "parse, then transform" paradigm. Zod validates the input first, then passes it through a chain of transformation functions. (For more information about transforms, read the [.transform docs](#transform).)
|
||||
|
||||
But sometimes you want to apply some transformation to the input _before_ parsing happens. A common use case: type coercion. Zod enables this with the `z.preprocess()`.
|
||||
|
||||
|
@ -1570,7 +1570,7 @@ z.union([z.string(), z.number()]);
|
|||
|
||||
### `.and`
|
||||
|
||||
A convenience method for creating interesection types.
|
||||
A convenience method for creating intersection types.
|
||||
|
||||
```ts
|
||||
z.object({ name: z.string() }).and(z.object({ age: z.number() })); // { name: string } & { age: number }
|
||||
|
@ -1679,7 +1679,7 @@ Tuples
|
|||
Recursive Types
|
||||
Function Schemas
|
||||
|
||||
<abbr title="For instance, Yup allows custmo error messages with the syntax yup.number().min(5, 'Number must be more than 5!')">Validation Messages</abbr>
|
||||
<abbr title="For instance, Yup allows custom error messages with the syntax yup.number().min(5, 'Number must be more than 5!')">Validation Messages</abbr>
|
||||
Immutable instances
|
||||
Type Guards
|
||||
Validity Checking
|
||||
|
|
|
@ -2902,7 +2902,7 @@ export class ZodEffects<
|
|||
constructor(def: ZodEffectsDef<T>) {
|
||||
super(def);
|
||||
// if (def.schema instanceof ZodEffects) {
|
||||
// throw new Error(ZodFirstPartyTypeKind.ZodEffectscannot be nested.");
|
||||
// throw new Error(ZodFirstPartyTypeKind.ZodEffects cannot be nested.");
|
||||
// }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue