ktongue/docker_container / .cache /opencode /node_modules /zod /src /v3 /tests /object-augmentation.test.ts
download
raw
569 Bytes
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
test("object augmentation", () => {
const Animal = z
.object({
species: z.string(),
})
.augment({
population: z.number(),
});
// overwrites `species`
const ModifiedAnimal = Animal.augment({
species: z.array(z.string()),
});
ModifiedAnimal.parse({
species: ["asd"],
population: 1324,
});
const bad = () =>
ModifiedAnimal.parse({
species: "asdf",
population: 1324,
} as any);
expect(bad).toThrow();
});

Xet Storage Details

Size:
569 Bytes
·
Xet hash:
d8a8c377052d1ec5c4aa9b623610faeae8b2ff60d63809f082cdedd690a57b1a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.