Storybook: Broken @storybook/addon-contexts types

Created on 26 Jan 2020  路  7Comments  路  Source: storybookjs/storybook

Describe the bug
Types for @storybook/[email protected] seem to be broken, causing following TypeScript error:

Could not find a declaration file for module '@storybook/addon-contexts/react'. '.../node_modules/@storybook/addon-contexts/react.js' implicitly has an 'any' type.
  Try `npm install @types/storybook__addon-contexts` if it exists or add a new declaration (.d.ts) file containing `declare module '@storybook/addon-contexts/react';`  TS7016

To Reproduce
import { withContexts } from '@storybook/addon-contexts/react';

Expected behavior
No errors

contexts bug inactive typescript

All 7 comments

Same issue for me

Using

import { withContexts } from '@storybook/addon-contexts/dist/preview/frameworks/react';

Works, but then TypeScript can't determine the type of the contexts argument because "Cannot find module '../../shared/types'."

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

I'd expect a way to get correct types without knowing internal structure of the library...

Looking to replace addon-contexts in SB6.0 with addon-toolbars that is much simpler and uses Storybook core features (args, decorators). Feedback welcome!

Open PR, API still under consideration: https://github.com/storybookjs/storybook/pull/10028

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ilias-t picture ilias-t  路  73Comments

EdenTurgeman picture EdenTurgeman  路  81Comments

tycho01 picture tycho01  路  76Comments

dependencies[bot] picture dependencies[bot]  路  142Comments

hckhanh picture hckhanh  路  69Comments