Skip to content

Private fields cause type errors on ref values #591

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

Closed
fango256 opened this issue Nov 19, 2020 · 2 comments
Closed

Private fields cause type errors on ref values #591

fango256 opened this issue Nov 19, 2020 · 2 comments

Comments

@fango256
Copy link

We have a fairly large vue/typescript project that occasionally runs into type issues when working with the composition api. I think it has something to do with private fields going through Ref/UnwrapRef. I think our usage is valid, but we are still getting to grips with it.

In the code below the myArray variable throws up the following error with TS 4.0.5:

import { ref } from "@vue/composition-api";

class MyClass {
  private memberVariable: string = "";
}

const myArray: MyClass = ref(new MyClass()).value;
         ^^ TS2741: Property 'memberVariable' is missing in type '{}' but required in type 'MyClass
@jacekkarczmarczyk
Copy link
Contributor

Likely related to vuejs/core#2557

@antfu
Copy link
Member

antfu commented Nov 20, 2020

Close for now in favor of vuejs/core#2557, please continue the discussion there. If it gets resolved and the patch gets shipped, we can then update this plugin to match their behavior.

@antfu antfu closed this as completed Nov 20, 2020
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

No branches or pull requests

3 participants