No type safety on zMutation or zQuery for arguments
Trying to server side validate data, and args are of type DefaultFunctionArgs with any field within as a any/unknown.

1 Reply
npx tsc --noEmit
convex/workspaces.ts:13:5 - error TS2740: Type 'ZodString' is missing the following properties from type 'ZodType<any, any, any>': _type, _parse, _getType, _getOrReturnCtx, and 7 more.
13 name: z.string().min(2).max(50),
~~~~
convex/workspaces.ts:19:7 - error TS2322: Type 'unknown' is not assignable to type 'string'.
19 name: args.name,
~~~~
node_modules/convex/dist/esm-types/type_utils.d.ts:11:97
11 export type Expand<ObjectType extends Record<any, any>> = ObjectType extends Record<any, any> ? {
~
12 [Key in keyof ObjectType]: ObjectType[Key];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 } : never;
~
The expected type comes from property 'name' which is declared here on type '{ name: string; ownerId: Id<"users">; }'
Found 2 errors in the same file, starting at: convex/workspaces.ts:13
npx tsc --noEmit
convex/workspaces.ts:13:5 - error TS2740: Type 'ZodString' is missing the following properties from type 'ZodType<any, any, any>': _type, _parse, _getType, _getOrReturnCtx, and 7 more.
13 name: z.string().min(2).max(50),
~~~~
convex/workspaces.ts:19:7 - error TS2322: Type 'unknown' is not assignable to type 'string'.
19 name: args.name,
~~~~
node_modules/convex/dist/esm-types/type_utils.d.ts:11:97
11 export type Expand<ObjectType extends Record<any, any>> = ObjectType extends Record<any, any> ? {
~
12 [Key in keyof ObjectType]: ObjectType[Key];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 } : never;
~
The expected type comes from property 'name' which is declared here on type '{ name: string; ownerId: Id<"users">; }'
Found 2 errors in the same file, starting at: convex/workspaces.ts:13