Skip to content

Commit

Permalink
Fix link
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Mar 15, 2024
1 parent d63bde4 commit 4a618ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ERROR_HANDLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Each ZodError has an `issues` property that is an array of `ZodIssues`. Each iss

`ZodIssue` is _not_ a class. It is a [discriminated union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions).

The link above is the best way to learn about the concept. Discriminated unions are an ideal way to represent a data structures that may be one of many possible variants. You can see all the possible variants defined [here](./src/ZodError.ts). They are also described in the table below if you prefer.
The link above is the best way to learn about the concept. Discriminated unions are an ideal way to represent a data structures that may be one of many possible variants. You can see all the possible variants defined [here](https://github.com/colinhacks/zod/blob/master/src/ZodError.ts). They are also described in the table below if you prefer.

_Every_ ZodIssue has these fields:

Expand Down
2 changes: 1 addition & 1 deletion deno/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4838,7 +4838,7 @@ export interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny>
export class ZodReadonly<T extends ZodTypeAny> extends ZodType<
MakeReadonly<T["_output"]>,
ZodReadonlyDef<T>,
T["_input"]
MakeReadonly<T["_input"]>
> {
_parse(input: ParseInput): ParseReturnType<this["_output"]> {
const result = this._def.innerType._parse(input);
Expand Down
6 changes: 6 additions & 0 deletions playground.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import { z } from "./src";

z;

function dataObj<T extends z.ZodTypeAny>(schema: T) {
return z.object({ data: schema as T }).transform((a: T['_output']) => a.data);
}

const arg= dataObj(z.string()).parse({ data: "asdf" });

0 comments on commit 4a618ef

Please sign in to comment.