Commit 89b0e92
fix(web): resolve TypeScript build errors for chat preferences
`next build` (which runs `tsc` strictly) caught three issues that
the looser ESLint pass missed. None are behavior changes — all are
type-correctness fixes.
1. `chatPreferencesPage.tsx`: `toggleVariants` only defines
`size: { default: ... }` (an icon-sized square), so `size="sm"`
on `<ToggleGroup>` was a type error. Removed the prop and overrode
sizing on each `<ToggleGroupItem>` via `className="h-9 w-auto
min-w-0 px-3"` so the text labels actually fit.
2. `features/chat/actions.ts` and `app/api/(server)/chat/route.ts`:
`chatPreferencesSchema` is built dynamically with
`z.enum(string[])`, which widens each level value to `string` in
the inferred type. Assigning `parsed.data` to the narrower
`ChatPreferences` literal-union map therefore failed strict
typecheck. Added an `as ChatPreferences` cast in both consumers
with a comment explaining why the cast is sound (runtime
validation still constrains each value to its per-dimension
level list).
3. `__mocks__/prisma.ts`: `MOCK_USER_WITH_ACCOUNTS` was missing the
two new User fields. Added `chatPreferences: {}` and
`chatCustomInstructions: null` so test code compiles against the
updated Prisma type.
Refs #1242, #1243
Co-authored-by: Cursor <[email protected]>1 parent bdcdc0b commit 89b0e92
4 files changed
Lines changed: 17 additions & 3 deletions
File tree
- packages/web/src
- __mocks__
- app
- (app)/settings/chatPreferences
- api/(server)/chat
- features/chat
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
| |||
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
111 | 115 | | |
112 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
586 | 592 | | |
587 | 593 | | |
588 | 594 | | |
| |||
0 commit comments