Skip to content

Commit

Permalink
docs: fix incomplete Records example (#2579)
Browse files Browse the repository at this point in the history
  • Loading branch information
messenjer committed Jul 31, 2023
1 parent ab8e717 commit d870407
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -1525,6 +1525,12 @@ type NumberCache = z.infer<typeof NumberCache>;
This is particularly useful for storing or caching items by ID.

```ts
const userSchema = z.object({ name: z.string() });
const userStoreSchema = z.record(userSchema);

type UserStore = z.infer<typeof userStoreSchema>;
// => type UserStore = { [ x: string ]: { name: string } }

const userStore: UserStore = {};

userStore["77d2586b-9e8e-4ecf-8b21-ea7e0530eadd"] = {
Expand Down
6 changes: 6 additions & 0 deletions README_ZH.md
Expand Up @@ -845,6 +845,12 @@ type NumberCache = z.infer<typeof NumberCache>;
这对于按 ID 存储或缓存项目特别有用。

```ts
const userSchema = z.object({ name: z.string() });
const userStoreSchema = z.record(userSchema);

type UserStore = z.infer<typeof userStoreSchema>;
// => type UserStore = { [ x: string ]: { name: string } }

const userStore: UserStore = {};

userStore["77d2586b-9e8e-4ecf-8b21-ea7e0530eadd"] = {
Expand Down
6 changes: 6 additions & 0 deletions deno/lib/README.md
Expand Up @@ -1524,6 +1524,12 @@ type NumberCache = z.infer<typeof NumberCache>;
This is particularly useful for storing or caching items by ID.

```ts
const userSchema = z.object({ name: z.string() });
const userStoreSchema = z.record(userSchema);

type UserStore = z.infer<typeof userStoreSchema>;
// => type UserStore = { [ x: string ]: { name: string } }

const userStore: UserStore = {};

userStore["77d2586b-9e8e-4ecf-8b21-ea7e0530eadd"] = {
Expand Down

0 comments on commit d870407

Please sign in to comment.