-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
Describe the bug
Hello,
We are using storybook with Typescript. When trying to upgrade to v8.0.10, we encountered a type issue when we want to suppress the automatic summary generated for Controls. Previously, we would make it null like so:
argTypes: {
myArg: {
table: {
type: { summary: null },
},
},
},With the change introduced at commit 3f7e1c2b84324ca24bc5bc968a6ab3245b11b757, null is no longer allowed. So we tried to use undefined instead. But since we use the stricter exactOptionalPropertyTypes: true configuration in our tsconfig.json, TypeScript raises the following error:
Type '{ summary: undefined; }' is not assignable to type '{ summary?: string; detail?: string; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'summary' are incompatible.
Type 'undefined' is not assignable to type 'string'.(2375)
Could you please change the type of summary to summary?: string | undefined so that we can keep our strict settings as well as disable the summary in controls ?
To Reproduce
Here is a link to reproduce: https://stackblitz.com/edit/github-wuwtca-dcgxst?file=src%2Fstories%2FButton.stories.ts
TypeScript raises an error in src/stories/Button.stories.ts, in argTypes property of meta.
System
Storybook Environment Info:
System:
OS: Linux 6.8 Fedora Linux 40 (Workstation Edition)
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Shell: 5.2.26 - /bin/bash
Binaries:
Node: 20.11.1 - /nix/store/lajyj1j3bkzcpiqra4phhs810zxglcp6-build-tools-js/bin/node
pnpm: 8.7.0 - /nix/store/lajyj1j3bkzcpiqra4phhs810zxglcp6-build-tools-js/bin/pnpm <----- active
npmPackages:
eslint-plugin-storybook: ^0.8.0 => 0.8.0Additional context
No response