zenstack/packages/clients/tanstack-query/test/schemas/basic
ymc9 1ba4e54066 refactor(schema): widen types for attributes, default, and foreignKeyFor in generated schema
The generated schema previously used `as const` on entire model/enum/typeDef
objects, causing TypeScript to deeply infer literal types for all nested
properties. This is unnecessary for `attributes`, `default`, and `foreignKeyFor`
which are only used at runtime, not in CRUD type computations.

Changes:
- Add type assertions (`as readonly AttributeApplication[]`, `as FieldDefault`,
  `as readonly string[]`) to prevent deep const inference on these properties
- Extract `FieldDefault` type alias from `FieldDef` for cleaner generated code
- Change `FieldHasDefault` to use key existence check (`'default' extends keyof`)
  instead of value type check, enabling the `default` widening
- Conditionally import `AttributeApplication` and `FieldDefault` only when used

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 19:51:43 -07:00
..
input.ts feat: exists operation (#550) 2026-01-07 18:05:49 +08:00
models.ts chore: rebuild and update test schemas (#671) 2026-02-08 11:29:32 +08:00
schema-lite.ts refactor(schema): widen types for attributes, default, and foreignKeyFor in generated schema 2026-03-12 19:51:43 -07:00
schema.zmodel fix(tanstack): delegate hooks typing (#370) 2025-11-05 12:24:38 -08:00