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: update vue-shims for Vue v3.0.1 #5975

Merged
merged 1 commit into from
Oct 19, 2020

Conversation

cexbrayat
Copy link
Member

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:
vuejs/core@6aa2256 intriduced a change in DefineComponent type, that results in a broken bare CLI app that would use VTU, as mount will not compile.

This relaxes the type definitation by using generic any.

Fixes #5974

Copy link
Contributor

@FossPrime FossPrime left a comment

Choose a reason for hiding this comment

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

It works. This seems like a reasonable compromise for now... there may be a case for defining types at a per component level down the road...

@@ -1,5 +1,5 @@
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent
const component: DefineComponent<any, any, any>
Copy link
Member

Choose a reason for hiding this comment

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

DefineComponent<{}, {}, any>

maybe?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 Yes, now that VTU beta.7 is out, this is enough.

vuejs/core@6aa2256 intriduced a change in `DefineComponent` type, that results in a broken bare CLI app that would use VTU, as `mount` will not compile.

This relaxes the type definitation by using generic `any`.

Fixes vuejs#5974
@cexbrayat
Copy link
Member Author

I updated the PR to use const component: DefineComponent<{}, {}, any> which is now enough to fix the issue with VTU 2.0.0-beta.7 out.

@haoqunjiang
Copy link
Member

Thanks!

@haoqunjiang haoqunjiang merged commit b2755d1 into vuejs:dev Oct 19, 2020
@alperkay
Copy link

I just created an app with vue/cli v4.5.8 . It looks like it uses Vue v3.0.2 and Vue Test Utils v2.0.0-beta.7 and I'm still having the same issue when I run the default unit test. The exact error is as follows:

[Vue warn]: Property "msg" was accessed during render but is not defined on instance.
      at <Anonymous msg="new message" ref="VTU_COMPONENT" >
      at <VTUROOT> 

Any idea?

@awerlang
Copy link

@alperkay that's a different matter. This PR targets a typing (i.e. compile-time) issue, yours is a runtime issue (missing prop declaration?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants