I have this kind of function: ```ts
const fieldTypeToSchema = </* const */ T extends ZodField>(field: T): z.ZodSchema<FieldValueType<T>> => {
if (field.type === "text") return z.string()
if (field.type === "url") return z.string().url()
if (field.type === "password") return z.string()
if (field.type === "email") return z.string().email()
if (field.type === "color") return z.string().regex(/#[\da-fA-F]{6}/)
return z.never()
}
(i added the `const` in a comment since it breaks discord highlighting)
but i get this error on every return: ```
Type 'ZodString' is not assignable to type 'ZodType<FieldValueType<T>, ZodTypeDef, FieldValueType<T>>'.
Types of property '_type' are incompatible.
Type 'string' is not assignable to type 'FieldValueType<T>'.
The ZodField type is a discriminated union, wherein each member has a schema field ((z.Schema) => z.Schema) and a type field.
the FieldValueType<T> type takes in a ZodField and returns the actual typescript type its schema returns (FieldValueType<{ type: "text" }> => string, FieldValueType<{ type: "number" }> => number, etc)
why does this not work the way i expect it to? shouldn't the type narrowing via the if statement tell TS that FieldValueType<T> is now the right type for the field?
types.ts: https://gist.github.com/TheOnlyTails/154a8a3eab6adae3a3721dfe6fcf8021
createForm.ts: https://gist.github.com/TheOnlyTails/fcd7ea53a40b55bce54399ce94df8c2e