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

docs: SetupContext.refs type, remove unnecessary docs #611

Merged
merged 3 commits into from Dec 14, 2020

Conversation

subdavis
Copy link
Contributor

@subdavis subdavis commented Dec 7, 2020

Fix docs bug introduced by #595

Error

ERROR in /home/user/github.com/VIAME-Web/client/platform/web-girder/views/ViewerLoader.vue(16,14):
16:14 Subsequent property declarations must have the same type.  Property 'refs' must be of type 'Data', but here has type '{ [key: string]: Element | Element[] | Vue | Vue[]; }'.
    14 | declare module '@vue/composition-api' {
    15 |   interface SetupContext {
  > 16 |     readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] }
       |              ^
    17 |   }
    18 | }
    19 | /**

Type of refs changed to unexported type Data. I've verified that this change works on a local project.

Copy link
Member

@pikax pikax left a comment

Choose a reason for hiding this comment

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

readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] } is the correct type for refs.

@subdavis
Copy link
Contributor Author

subdavis commented Dec 8, 2020

I agree, that should be the correct type. But it won't build since a conflicting type was added. Your snippet will not build as a result of #595 via "^1.0.0-beta.18"

Either the type needs to change or the docs need to change. It should probably be corrected here instead:

https://github.com/antfu/composition-api/blob/b7e178e23d75f59cf2af7881debe53911cb57979/src/component/componentOptions.ts#L28

I assume the person that wrote that line saw the existing Data and used it, unaware of the existing documentation issue it would cause.

@pikax
Copy link
Member

pikax commented Dec 8, 2020

Can you change https://github.com/vuejs/composition-api/blob/master/src/component/componentOptions.ts#L28 instead to have the correct type?

Copy link
Member

@pikax pikax left a comment

Choose a reason for hiding this comment

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

Thank you

@subdavis subdavis changed the title Bugfix: README.md Fix SetupContext.refs type, remove unnecessary docs Dec 8, 2020
@antfu antfu changed the title Fix SetupContext.refs type, remove unnecessary docs docs: SetupContext.refs type, remove unnecessary docs Dec 14, 2020
@antfu antfu merged commit 27ff2f3 into vuejs:master Dec 14, 2020
@subdavis subdavis deleted the patch-1 branch December 14, 2020 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants