zod 4.1.0-canary.20250724T211341 → 4.1.0-canary.20250725T001018
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod",
|
|
3
|
-
"version": "4.1.0-canary.
|
|
3
|
+
"version": "4.1.0-canary.20250725T001018",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Colin McDonnell <zod@colinhacks.com>",
|
|
6
6
|
"description": "TypeScript-first schema declaration and validation library with static type inference",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { File as WebFile } from "@web-std/file";
|
|
2
2
|
|
|
3
|
-
import { afterEach, beforeEach, expect, test } from "vitest";
|
|
3
|
+
import { afterEach, beforeEach, expect, expectTypeOf, test } from "vitest";
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
|
|
@@ -26,6 +26,10 @@ test("passing validations", () => {
|
|
|
26
26
|
expect(() => mimeCheck.parse(new File([""], "test.txt", { type: "text/csv" }))).toThrow();
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
+
test("types", () => {
|
|
30
|
+
expectTypeOf(z.file().parse(new File([], "test.txt"))).toEqualTypeOf(new File([], "test.txt"));
|
|
31
|
+
});
|
|
32
|
+
|
|
29
33
|
test("failing validations", () => {
|
|
30
34
|
expect(minCheck.safeParse(new File(["1234"], "test.txt"))).toMatchInlineSnapshot(`
|
|
31
35
|
{
|
package/src/v4/core/schemas.ts
CHANGED
|
@@ -2862,8 +2862,8 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
|
|
|
2862
2862
|
type _File = typeof globalThis extends { File: infer F extends new (...args: any[]) => any } ? InstanceType<F> : {};
|
|
2863
2863
|
/** Do not reference this directly. */
|
|
2864
2864
|
export interface File extends _File {
|
|
2865
|
-
type: string;
|
|
2866
|
-
size: number;
|
|
2865
|
+
readonly type: string;
|
|
2866
|
+
readonly size: number;
|
|
2867
2867
|
}
|
|
2868
2868
|
|
|
2869
2869
|
export interface $ZodFileDef extends $ZodTypeDef {
|
package/v4/core/schemas.d.cts
CHANGED
|
@@ -768,8 +768,8 @@ type _File = typeof globalThis extends {
|
|
|
768
768
|
} ? InstanceType<F> : {};
|
|
769
769
|
/** Do not reference this directly. */
|
|
770
770
|
export interface File extends _File {
|
|
771
|
-
type: string;
|
|
772
|
-
size: number;
|
|
771
|
+
readonly type: string;
|
|
772
|
+
readonly size: number;
|
|
773
773
|
}
|
|
774
774
|
export interface $ZodFileDef extends $ZodTypeDef {
|
|
775
775
|
type: "file";
|
package/v4/core/schemas.d.ts
CHANGED
|
@@ -768,8 +768,8 @@ type _File = typeof globalThis extends {
|
|
|
768
768
|
} ? InstanceType<F> : {};
|
|
769
769
|
/** Do not reference this directly. */
|
|
770
770
|
export interface File extends _File {
|
|
771
|
-
type: string;
|
|
772
|
-
size: number;
|
|
771
|
+
readonly type: string;
|
|
772
|
+
readonly size: number;
|
|
773
773
|
}
|
|
774
774
|
export interface $ZodFileDef extends $ZodTypeDef {
|
|
775
775
|
type: "file";
|