-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: 7.2.0
breaks Vue JSX types
#23819
Comments
cc @chakAs3 repository is private but the issue has been verified across two different environments/machines |
@floroz let me check it out we did not have any major update for Vue between these version but i will investigate this |
@chakAs3 I forked you custom-render project and create a reproduction for the error: https://github.com/floroz/storybook-vue-custom-render/tree/bug/jsx-error-storybook If you |
7.2.0
breaks Vue JSX types
@chakAs3 I spent some time looking into the issue and found that:
I suspect the regression was introduced by #23574 I tried to fork the Storybook repo and reverted Happy to continue troubleshooting this myself but I might need some assistance from your side (although I suspect you could verify this quite quickly). |
hi @floroz i doubt that there is a regression, i think you were using my fork which support fully JSX, i may have to update it as the maybe a version conflict |
@chakAs3 I used your fork just as a boilerplate starting point, but I replaced the dependencies to point at the published version of storybook, not your renderer. If you check out that branch that I linked in the fork you should see the reproduction of the same error we have in our company project. You can create a project from scratch and install |
Note to core team: Aside from figuring out what's causing this issue, we should also add tests for Vue JSX to prevent this from breaking again. |
Hi @vanessayuenn, the main reason is the renderer implementation that should be done properly, i have a repo with all type of custom render functions including JSX @floroz can please check as well if it is working i updated the fork |
@chakAs3 which is the updated fork you are referring to? |
@chakAs3 hi, I have also encountered this issue. Is there any latest progress? thanks |
@DediWang1990 is your issue types only or rendering ? |
@chakAs3 only types. When using version 7.1.0 before, the type of args could be correctly obtained. However, after upgrading to the latest version, the type of args has been broken. By the way, I also use JSX. |
JSX a good option to have consistent rendering API, easy to migrate your code between React/ Vue / Preact / Lit. i will investigate about this Type issue, i think maily is the new vue-tsc |
I'm also having this issue. I can resolve some of the errors by doing something like this (but is not really a viable solution): import { JSXComponent } from 'vue';
import BButton from '@/components/BButton';
const JsxButton: JSXComponent = BButton;
const render = () => <JsxButton />; |
@treardon17 no worries i will get this fixed once i got sometime, after the release of Nuxt-Storybook module |
Hey @chakAs3, I appreciate you have a lot on your plate, but was wondering if you had the chance to look at this issue? It's currently blocking projects using JSX to upgrade from |
hi @floroz please create the repo for me with your issue, easier for me as reference to fix. |
@chakAs3 https://github.com/floroz/storybook-jsx-bug-720 You can see the error in src/stories/Button.stories.tsx:17:26 - error TS2786: 'Button' cannot be used as a JSX component.
Its type 'DefineComponent<{ label: { type: PropType<string>; required: true; }; primary: { type: PropType<boolean>; default: boolean; }; size: { type: PropType<"small" | "medium" | "large">; }; backgroundColor: { ...; }; }, ... 11 more ..., {}>' is not a valid JSX element type.
Type 'DefineComponent<{ label: { type: PropType<string>; required: true; }; primary: { type: PropType<boolean>; default: boolean; }; size: { type: PropType<"small" | "medium" | "large">; }; backgroundColor: { ...; }; }, ... 11 more ..., {}>' is not assignable to type 'new (props: any, deprecatedLegacyContext?: any) => Component<any, any, any>'.
Type '{ $: ComponentInternalInstance; $data: {}; $props: { primary?: boolean | undefined; readonly label: string; style?: unknown; onClick?: ((id: number) => any) | undefined; ... 12 more ...; onVnodeUnmounted?: VNodeMountHook | ... 1 more ... | undefined; }; ... 10 more ...; $watch<T extends string | ((...args: any) => a...' is missing the following properties from type 'Component<any, any, any>': context, setState, forceUpdate, render, and 3 more.
17 return () => <div><Button {...args} /></div> |
For everyone bumping into this, we ended up migrating away from JSX since we also found some conflicts between global JSX types propagated by Relates to:
|
yes the conflicts come from storybook requires react even in Vue project, we are working on dropping this in v8, so you can go back to JSX If it necessary |
Is this React dependency also going to be dropped for @storybook/addon-docs? I see it is still required in the latest version - 8.0.0-rc.5. This is the only thing blocking a standard Vue/Storybook 8 project now where JSX is used within Vue components. When I removed |
Hey!Maybe you can try this one |
Describe the bug
After upgrading from our last version
7.1.0
to7.2.0
or7.3.0-alpha
, all our Vue JSX Stories are now broken.7.1.0
is stable and types are working correctly7.2.0
upwards all the types in JSX stories are broken and failingvue-tsc
check.The Stories are still working correctly but all files now contain JSX errors.
This is the blueprint for all our Stories setup using Vue 3 (
script setup
) and JSX.Our tsconfigs:
To Reproduce
<script setup lang="ts" />
syntax which containsdefineProps
anddefineSlots
vue-tsc
against those storiesSystem
Additional context
No response
The text was updated successfully, but these errors were encountered: