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(type): fix incorrect ref unwrap #344

Merged
merged 4 commits into from Jun 3, 2020
Merged

Conversation

antfu
Copy link
Member

@antfu antfu commented May 31, 2020

resolve #257

Align with vue-next
https://github.com/vuejs/vue-next/blob/c6217b4d46cbd3d9e250f2f84de4846d3484c42d/packages/reactivity/src/ref.ts#L30-L37

I am not sure how these lines work in our current codebase

// with init value: a = ref({ a: ref(0) })
// typeof a will be Ref<{ a: number }>
export function ref<S, T = unknown, R = HasDefined<S> extends true ? S : RefValue<T>>(
  raw: T
): Ref<R>;

I kept it for now. But since it's not in vue-next, should we just remove it in order to have better type consistency with vue-next?

Edit: Removed and it's exactly matched to vue-next now.

@pikax
Copy link
Member

pikax commented Jun 1, 2020

Once #311 is merged we should be able keep the vue-next types in sync easily

@antfu
Copy link
Member Author

antfu commented Jun 2, 2020

@pikax This seems to not be covered by #311. I have made it exactly matched to vue-next now.

package.json Outdated Show resolved Hide resolved
@antfu antfu merged commit 70452af into vuejs:master Jun 3, 2020
@antfu antfu mentioned this pull request Jun 3, 2020
@antfu antfu deleted the fix/ref-type branch June 3, 2020 20:04
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.

Unexpected type inference when creating ref in function call
2 participants