zenstack-nullable-field-types
Installation
SKILL.md
ZenStack Nullable Field Type Mismatches
Problem
ZenStack query results return null for nullable database fields, but TypeScript interfaces and Zod schemas often expect undefined for optional fields. This causes type errors when passing query results to components or functions that use schema types.
Context / Trigger Conditions
Exact Error Pattern:
error TS2322: Type 'string | null' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'.
When This Occurs:
- Passing ZenStack query results directly to React components
- Component props use Zod schema types (e.g.,
z.infer<typeof mySchema>) - Database schema has nullable fields:
field String? - Query results include nullable fields without type transformation