Skip to content
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

fix(nuxt): augment @vue/runtime-core and @vue/runtime-dom #28446

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Aug 7, 2024

🔗 Linked issue

resolves #28373, resolves #28440

📚 Description

Currently we need to augment vue, @vue/runtime-dom and @vue/runtime-core - or it will be possible that a library which augments only one of these will 'break' type augmentation.

However, it might be we have an opportunity across the ecosystem to migrate to augmenting only one of these (ideally just vue: https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties). Removing these duplicate augmentations would also fix the issue in a minimal install of Nuxt but likely needs to be updated in other libraries/projects.

cc: @johnsoncodehk, @posva

Copy link

stackblitz bot commented Aug 7, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions github-actions bot added the 3.x label Aug 7, 2024
@posva
Copy link
Collaborator

posva commented Aug 7, 2024

In the long run, it will be easier for library maintainers if they can just declare module 'vue' rather than using three different module augmentations that are just copy-paste.

I don't know if this also affects end users: does their code break if they use the currently documented solution of declare module 'vue' in a project that has a library installed that uses a different module augmentation?

Copy link

@PerryProjects PerryProjects left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it local in VSCode and in Stackblitz and it seams to work for now.

@danielroe danielroe merged commit d51365f into main Aug 8, 2024
40 checks passed
@danielroe danielroe deleted the fix/augments branch August 8, 2024 08:49
@github-actions github-actions bot mentioned this pull request Aug 8, 2024
@Anoesj
Copy link
Contributor

Anoesj commented Aug 8, 2024

Found this because of #28373. I see this is merged into main, great to see a solution has been found, thanks! When something is merged into main, does that mean this is being released with the next release, so 3.12.5 / 3.13.0? I don't know about the branching/versioning strategy, so probably asking a stupid question here 😇

@daniandl
Copy link

daniandl commented Aug 9, 2024

Found this because of #28373. I see this is merged into main, great to see a solution has been found, thanks! When something is merged into main, does that mean this is being released with the next release, so 3.12.5 / 3.13.0? I don't know about the branching/versioning strategy, so probably asking a stupid question here 😇

Daniel confirmed on Discord it would be coming in 3.x

image

@dargmuesli
Copy link
Member

Yes, it'll be part of the next release. You can also use the Nightly Release Channel to have the fix included right now.

@tjbp
Copy link

tjbp commented Aug 21, 2024

I've just tested this with the Nightly Release Channel (npm:nuxt-nightly@3x) and unfortunately still had the type error for auto-imports used in the template (problem doesn't occur if the auto-import is referenced in the script block).

@danielroe
Copy link
Member Author

@tjbp would you provide a reproduction? This can also be caused by other libraries.

@tjbp
Copy link

tjbp commented Aug 21, 2024

@danielroe I've been trying to but have failed - so it's probably as you say. Sorry don't want to derail a closed PR but would I probably be looking for other libraries that also augment Vue's types in a similar way? (Ed: And thanks!)

@danielroe
Copy link
Member Author

danielroe commented Aug 22, 2024

Exactly!

I've raised a handful of PRs (all linked to #28542) that swap out declare module '@vue/runtime-core' with declare module 'vue'. If you spot more out there, I think it would be very helpful to submit PRs...

You can try running this as a debug step:

grep -RHl 'declare module .@vue.runtime-core' node_modules

n0099 added a commit to n0099/open-tbm that referenced this pull request Aug 23, 2024
n0099 added a commit to n0099/open-tbm that referenced this pull request Aug 25, 2024
…t/nuxt#28446

* fix class `ms-1` only occurs on not-2th username @ `<PostBadgeThreadAuthorAndLatestReplier>`
- prop `expandRowByClick` of `<ATable>` @ <PostRendererTable>`

* widden the type of param `name` of `routeNameWithCursor()` and guard it against `assertRouteNameIsStr()` to be like `routeNameWithoutCursor()`
* only return the modified route name and param `cursor` without any parts like `query` or other params from param `route` @ `getNextCursorRoute()`
@ router.ts

* fix regression of 0917db2 as `defineOgImageComponent()` now seem being able to `unref()` internally: nuxt-modules/og-image#190 @ post/seo/index.ts
@ utils
@ fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error with vue-tsc 2.0.29 Property '$route' does not exist on type
7 participants