Skip to content

Commit

Permalink
Fix small typos
Browse files Browse the repository at this point in the history
Fix two small mistakes in README.md:

* Grammar: Change "it's" to "its" in one place
* Add some spaces before a "^^^^" to point to what it is supposed to point to.
  • Loading branch information
mmorearty authored Mar 19, 2024
1 parent 18a0c28 commit 43aac95
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ inferSchema(z.string());

This approach loses type information, namely _which subclass_ the input actually is (in this case, `ZodString`). That means you can't call any string-specific methods like `.min()` on the result of `inferSchema`.

A better approach is to infer _the schema as a whole_ instead of merely it's inferred type. You can do this with a utility type called `z.ZodTypeAny`.
A better approach is to infer _the schema as a whole_ instead of merely its inferred type. You can do this with a utility type called `z.ZodTypeAny`.

```ts
function inferSchema<T extends z.ZodTypeAny>(schema: T) {
Expand Down Expand Up @@ -2747,7 +2747,7 @@ Due to how TypeScript inference works, it is treating `schema` like a `ZodTypeAn
```ts
function parseData<T extends z.ZodTypeAny>(data: unknown, schema: T) {
return schema.parse(data) as z.infer<T>;
// ^^^^^^^^^^^^^^ <- add this
// ^^^^^^^^^^^^^^ <- add this
}

parseData("sup", z.string());
Expand Down

0 comments on commit 43aac95

Please sign in to comment.