How do I get TypeScript types for properties inside the parameters object? #33649
Replies: 1 comment
-
|
There’s no official Storybook documentation for enabling TypeScript autocomplete for properties like How to enable autocomplete for
// storybook-parameters.d.ts
import type { DocsParameters } from '@storybook/addon-docs';
declare module '@storybook/types' {
interface Parameters {
docs?: DocsParameters;
}
}This will give you type safety and autocomplete for Limitations:
Alternative: You can follow issue #22860 for updates on official support or documentation for this pattern. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hey, so I wanted to add a small description a story. I found out from the docs that I need to target the
parameters.docs.description.storyproperty to do so. https://storybook.js.org/docs/api/doc-blocks/doc-block-descriptionWhile it works, I didn't get any TypeScript auto complete for it.
When I searched it up a bit I found couple of discussions regarding this:
#22860
#19833
But it's still not clear to me what steps I need to follow in order to get it working. Is this documented somewhere in the docs? I couldn't find anything on the docs, but there's a good chance I may have missed it.
I doubt an important feature like this would be just limited to a PR note, so I am not sure whether that solution given in the PR is latest solution or is there anything new regarding this topic.
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions