-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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.0.18 Vue typescript regression on slot typing #22853
Comments
I get these errors in VSCode with Volar 1.7.8, but not with vue-tsc 1.6.5 when linting my code locally. I wonder against which version of Vue and the Vue type helpers this was tested, and what's missing on my end. |
I found a determining factor with some help from Kasper: the IDE fails to build when the vue-tsc NPM package is on the So, this seems to be linked to vue-tsc not being updated correctly on NPM. It's possible the Vue devs pushed under the wrong dist-tag, I'll follow up with them. I'm leaving this issue open to let you decide if the Vue fix should be reverted until the right version of vue-tsc is available on NPM or not. Workaround for this issue:
|
Thanks for the investigation @Sidnioulz! We test our Vue type definitions with vue-tsc@1.7.8 in the monorepo. |
The Volar devs confirmed, if I understood what they said properly, that 1.7.8 is indeed pre-prod and not yet intended to be released. |
Thanks for confirming @Sidnioulz! Okay, great, so I will just use: "dependencies": {
"@storybook/core-client": "7.1.0-alpha.30",
"@storybook/docs-tools": "7.1.0-alpha.30",
"@storybook/global": "^5.0.0",
"@storybook/preview-api": "7.1.0-alpha.30",
"@storybook/types": "7.1.0-alpha.30",
"ts-dedent": "^2.0.0",
"type-fest": "^3.11.0",
"vue-component-type-helpers": "latest"
}, Or maybe I really should make it a peer dep right? So that the user can choose themself what version to use? |
@kasperpeulen, https://www.npmjs.com/package/vue-component-type-helpers?activeTab=versions shows that When we had 1.6.5, we had issues. With 1.7.8, it was fine, and we had a report that 1.6.4 worked too from our of our users (which I did not verify). So if you want to set the dependency to a working version, I would say |
@Sidnioulz I think they should all point to 1.6.5. |
In my IDE, I am not sure. I'm not on the official VSCode but a FOSS version that appears to have differently packaged / versioned extensions sometimes. Mine is 0.34.x and likely irrelevant. I had a colleague with 1.6.5 in their IDE who did experience a TS bug related to the types of parameters for some event listeners defined with Locally with vue-tsc, my colleagues found that 1.6.4 works, 1.6.5 doesn't, and 1.7.x work. I will now reopen the MWE above and re-run vue-tsc with all three versions to confirm. |
I can't repro either on the MWE repo I shared above. All combinations of 1.6.4, 1.6.5 and 1.7.8 of vue-tsc work without generating issues whether or not I In my IDE, I get a type error if using the Volar Typescript plugin (unknown exact version, see above), regardless of the vue-tsc package installed locally (which makes sense now, I don't know what was going on when I wrote the initial report and why this had an impact). Using Volar takeover mode in my IDE with no Typescript extension also worked great with either of the 3 tested vue-tsc versions. I'm not seeing any further clues in my org's Slack channel, so I guess this can just be closed. If anyone ends up with the same odd IDE setup I seem to have, they can use the workaround shared on this page by Kasper or switch to Volar takeover mode with no TS (which is apparently the setup recommended by the TS Volar extension). |
Describe the bug
Before 7.0.18, specifically this PR https://github.com/storybookjs/storybook/pull/22814/files, I was able to define properties for slots in my StoryObj
args
:Now, those properties are no longer visible in
args
's computed type. We get the following TS error:This happens regardless of whether
defineSlots
is used to type slots on the Vue SFC file.To Reproduce
Use https://github.com/chakAs3/vue3-storybook-slots-examples for a MWE. Open
src/stories/ReactiveSlots.stories.ts
and notice args doesn't accept any of the slots keys any more.System
Additional context
No response
The text was updated successfully, but these errors were encountered: