zenstack/tests/e2e/github-repos/cal.com
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 chore: regenerate ts schemas (#583) 2026-01-09 17:48:30 +08:00
models.ts fix(schema): use type-only imports to prevent bundling server dependencies in client code (#668) 2026-02-07 23:25:23 +08:00
schema.ts refactor(schema): widen types for attributes, default, and foreignKeyFor in generated schema 2026-03-12 19:51:43 -07:00
schema.zmodel fix(zmodel): more validation about "view" (#526) 2025-12-23 12:40:17 +08:00