We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60006f5 commit 74afc7cCopy full SHA for 74afc7c
packages/convex-helpers/index.test.ts
@@ -1,3 +1,4 @@
1
+import { v } from "convex/values";
2
import { withoutSystemFields } from "./index.js";
3
import { test, expect, expectTypeOf } from "vitest";
4
@@ -27,3 +28,14 @@ test("withoutSystemFields type when it's a union", () => {
27
28
expect(without2).toEqual({ a: "a" });
29
expectTypeOf(without2).toEqualTypeOf<{ a: string } | { b: string }>();
30
});
31
+
32
+test("withoutSystemFields works on validators too", () => {
33
+ const validator = v.object({
34
+ _id: v.string(),
35
+ _creationTime: v.number(),
36
+ a: v.string(),
37
+ });
38
+ const { _id, _creationTime, ...rest } = validator.fields;
39
+ const without = withoutSystemFields(validator.fields);
40
+ expectTypeOf(without).toEqualTypeOf<typeof rest>();
41
+});
0 commit comments