Fix/storybook typescript errors#25
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR updates Storybook stories/helpers (and one component test) to resolve TypeScript typing issues by introducing explicit story args types and tightening Storybook control definitions.
Changes:
- Refactors many
*.stories.tsxfiles to use explicitMeta<...Args>/StoryObj<typeof meta>typings and updatedargTypes.controlshapes. - Updates MultiCombobox story helpers/stories to use shared
MultiComboboxStoryArgstypes and simplified args plumbing. - Adjusts
TableVirtualizedtest typings to satisfy@tanstack/*type expectations.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/table-virtualized/table-virtualized.test.tsx | Adds explicit react-table types/casts and updates virtualizer callback invocation to satisfy TS. |
| src/components/table-key-value-pair/table-key-value-pair.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/slot/slot.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/sidebar/sidebar.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/sidebar-container/sidebar-container.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/section/section.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/page/page.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/menu/menu-title/menu-title.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/menu/menu-separator/menu-separator.stories.tsx | Introduces explicit story args typing and refactors render args usage. |
| src/components/menu/menu-info-item/menu-info-item.stories.tsx | Introduces explicit story args typing and refactors render args usage. |
| src/components/form-field/textarea/textarea.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/form-field/text-input/text-input.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/form-field/search-input/search-input.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/form-field/radio-input/radio-input.stories.tsx | Introduces explicit story args typing and updates controls (select control config adjusted). |
| src/components/form-field/radio-box/radio-box.stories.tsx | Introduces explicit story args typing and updates controls (select control config adjusted). |
| src/components/form-field/multi-combobox/multi-combobox.story-helpers.tsx | Tightens argTypes typing for shared MultiCombobox story args/helpers. |
| src/components/form-field/multi-combobox/multi-combobox.stories.tsx | Switches to typed shared args/helpers and simplifies render arg handling. |
| src/components/form-field/multi-combobox/multi-combobox-tags.stories.tsx | Switches to typed shared args/helpers and simplifies render arg handling. |
| src/components/form-field/multi-combobox/multi-combobox-custom-value.stories.tsx | Switches to typed shared args/helpers and simplifies render arg handling. |
| src/components/form-field/multi-combobox/multi-combobox-badges.stories.tsx | Switches to typed shared args/helpers and simplifies render arg handling. |
| src/components/featured-tag/featured-tag.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/divider-line/divider-line.stories.tsx | Introduces explicit story args typing and refactors render args usage. |
| src/components/disclosure/disclosure.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
| src/components/button-group/button-group.stories.tsx | Introduces explicit story args typing and updates Storybook control definitions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| observeElementOffset: (_instance, callback) => { | ||
| callback(0) | ||
| ;(callback as (offset: number, sync?: boolean) => void)(0, false) |
There was a problem hiding this comment.
The observeElementOffset callback is being invoked via a type assertion. If the intent is just to satisfy the expected callback signature, prefer calling it directly with the correct argument list instead of casting (this keeps the virtualizer types checked and avoids drifting from the actual library signature).
| ;(callback as (offset: number, sync?: boolean) => void)(0, false) | |
| callback(0, false) |
| defaultValue: { | ||
| control: 'select', | ||
| options: ['value_1', 'value_2', 'value_3'], | ||
| control: { type: 'select', options: ['value_1', 'value_2', 'value_3'] }, |
There was a problem hiding this comment.
For Storybook controls, options should be defined on the argType (same level as control), not nested inside the control object. As written, Storybook may ignore the options and the select control won’t be configured correctly.
| control: { type: 'select', options: ['value_1', 'value_2', 'value_3'] }, | |
| control: { type: 'select' }, | |
| options: ['value_1', 'value_2', 'value_3'], |
| defaultValue: { | ||
| control: 'select', | ||
| options: ['value_1', 'value_2', 'value_3'], | ||
| control: { type: 'select', options: ['value_1', 'value_2', 'value_3'] }, |
There was a problem hiding this comment.
For Storybook controls, options should be defined on the argType (same level as control), not nested inside the control object. Keeping the existing pattern used elsewhere (e.g. control: 'select' + options: [...]) avoids Storybook ignoring the options.
| control: { type: 'select', options: ['value_1', 'value_2', 'value_3'] }, | |
| control: 'select', | |
| options: ['value_1', 'value_2', 'value_3'], |
| <TableVirtualized<RowData> | ||
| data={data} | ||
| columnDefs={columnDefs} | ||
| columnDefs={columnDefs as ColumnDef<RowData>[]} |
There was a problem hiding this comment.
columnDefs is being force-cast to ColumnDef<RowData>[], which hides the underlying generic mismatch between createColumnHelper() column defs (typed with a concrete cell value type) and TableVirtualized's columnDefs prop. Prefer to fix the typing so the test can pass columnDefs without an assertion (e.g., by updating TableVirtualized to preserve the TableValue generic, or by typing columnDefs to match the component’s expected value type).
Description
Storybook Helpers fixes / updates
Checklist