Describe the bug
Having a simple zod4 object:
(ignore the enumValues, it's just an array of strings)
const setPolicySchema = z.object({
policyAvailableAccessTypes: z.enum(gateAccessTypeEnum.enumValues).array().default(['unlimited']),
})
When using it on the front-end like that:
<Checkbox {...setGatePolicyForm.fields.policyAvailableAccessTypes.as('checkbox', 'unlimited')}>
Unlimited
</Checkbox>
it completely loses the definition for .as()
As strange as it is, if we ignore intellisense, the code works and everything renders fine,
so my assumption is: there is a missing type definition for that use.
EDIT:
I dicovered that types works fine, when the .default([]) is missing:
const setPolicySchema = z.object({
policyAvailableAccessTypes: z.enum(gateAccessTypeEnum.enumValues).array(),
})
EDIT 2:
I also found out this was not a problem in previous versions of svelte, so it is a regression.
Reproduction
I will not waste your time with reproduction repos etc.
because it's working fine, but is propably typed incorrectly.
System Info
"svelte": "5.55.4",
"@sveltejs/kit": "2.57.1",
"zod": "^4.1.13",
Severity
annoyance
Additional Information
No response
Describe the bug
Having a simple zod4 object:
(ignore the enumValues, it's just an array of strings)
When using it on the front-end like that:
it completely loses the definition for
.as()As strange as it is, if we ignore intellisense, the code works and everything renders fine,
so my assumption is: there is a missing type definition for that use.
EDIT:
I dicovered that types works fine, when the
.default([])is missing:EDIT 2:
I also found out this was not a problem in previous versions of svelte, so it is a regression.
Reproduction
I will not waste your time with reproduction repos etc.
because it's working fine, but is propably typed incorrectly.
System Info
Severity
annoyance
Additional Information
No response