- $ref<Reference>(reference: ConstExpr<Reference>, options?: SchemaOptions<object, Reference[infer]>): RefType<Intrinsic<Reference>>
- $ref<T>(reference: T, options?: SchemaOptions<object>): ZodSchemaAsNode<T>
- $ref<T>(reference: Schema<T>, options?: SchemaOptions<object>): SchemaAsNode<T>
- $ref<T>(reference: T, options?: SchemaOptions<object>): Promise<RefType<NodeTrait & { infer: Infer<T> }>>
Type parameters
Parameters
reference: ConstExpr<Reference>
optionaloptions: SchemaOptions<object, Reference[infer]>
Returns RefType<Intrinsic<Reference>>
Create a new
RefType
instance with the given options.Example