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

types(defineComponent): fix unwrap when returning Ref<T>|undefined from setup #4100

Merged

Conversation

pikax
Copy link
Member

@pikax pikax commented Jul 10, 2021

fix #3990

ShallowUnwrapRef was not handling the Ref<T>|undefined type

Minimal repro

defineComponent({
  setup() {
    return {
      a: undefined as Ref<number> | undefined
    }
  },
  methods: {
    test() {
      // @ts-expect-error `a` should not be a ref
      this.a?.value
    }
  }
})

@pikax pikax requested a review from yyx990803 July 10, 2021 08:14
@yyx990803 yyx990803 merged commit f6a5f09 into vuejs:master Jul 15, 2021
@pikax pikax deleted the types/unwrap_ref_unwrap_Ref_or_undefined branch August 15, 2021 09:09
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.

Union types aren't unwrapped
3 participants