-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Closed
Labels
Description
Describe the bug
Ok this is a fun one. Basically tsc complains about missing react typings, when trying to use create of @storybook/theming.
This is because:
@storybook/themingimports@emotion/*- which in turn imports
react - which in turn requires
@types/react - which would have to be installed manually
- which would then declare global
JSXnamespace - which would then conflict with the
JSXnamespace of Vue
To Reproduce
- create Vue project with TS support via Vue CLI 3
- Storybook via vue-cli-plugin-storybook (TS conversion and config must be done by hand)
- Vue JSX/TSX typings -> https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-typescript/generator/template/src/shims-tsx.d.ts
- Create theme:
import { create } from '@storybook/theming';
export default create({
base: 'light',
brandTitle: 'My Storybook',
});npx tsc
Expected behavior
Use create from @storybook/theming without requiring react typings and therefore no JSX namespace conflicts.
System:
- OS: any
- Device: any
- Browser: any
- Framework: vue
- Version: 5
Additional context
Workaround:
- dont use storybook theming
- or dont use vue jsx/tsx
- or run tsc with
--skipLibCheck
Solution:
- provide a
createtheme function/module that does not use@emotion/* - the only stuff that
createrequires from@emotion/*isimport { css, keyframes } from '@emotion/core';inanimation.ts) - where
csstype doesnt requirereacttypings (so no problem here), but is imported from@emotion/coretypes, which importsreacttypings for other stuff (this is a problem) -> importcssfrom@emotion/css - where
keyframestype doesnt requirereacttypings (so no problem here), but its type is declared in@emotion/coretype declaration file that importsreacttypings, but actually dont use react typings forkeyframesitself (but for other stuff) -> ask for upstream change in emotion (which would maybe require some reorganisation of types/exports on their part) or reimplement/c&pkeyframesinto@storybook/themingor dont usekeyframesduringcreate
Reactions are currently unavailable