Skip to content

Typescript error since Zod 4.0.11+: is missing the following properties from type 'TSchema': params, static, [Kind] #626

@jamesst20

Description

@jamesst20

Description

  import type { SuperValidated, Infer } from "sveltekit-superforms";
  import type { FormSchema } from "$routes/.../schemas";
  type Props = { form: SuperValidated<Infer<FormSchema>>; };
  let { form, ... }: Props = $props();

Since Zod 4.0.11, SuperValidated<Infer<FormSchema>>; raises a Typescript error:

Type 'ZodObject<{ id: ZodOptional<ZodNumber>; protocol: ZodLiteral<"rtsp">; name: ZodString; host: ZodString; port: ZodCoercedNumber<unknown>; username: ZodString; password: ZodOptional<...>; path: ZodString; }, $strip>' does not satisfy the constraint 'Schema'.
  Type 'ZodObject<{ id: ZodOptional<ZodNumber>; protocol: ZodLiteral<"rtsp">; name: ZodString; host: ZodString; port: ZodCoercedNumber<unknown>; username: ZodString; password: ZodOptional<...>; path: ZodString; }, $strip>' is not assignable to type 'TSchema | Schema<any, any, any, "">'.
    Type 'ZodObject<{ id: ZodOptional<ZodNumber>; protocol: ZodLiteral<"rtsp">; name: ZodString; host: ZodString; port: ZodCoercedNumber<unknown>; username: ZodString; password: ZodOptional<...>; path: ZodString; }, $strip>' is missing the following properties from type 'TSchema': params, static, [Kind]ts(2344)
Image

Workaround

Downgrading to Zod 4.0.10 resolves the issue.

Additional notes

The error is also present in the next versions of Zod: 4.0.11, 4.0.12, 4.0.13 (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions