core icon indicating copy to clipboard operation
core copied to clipboard

Getting a Type Error with Ref on an instance of a Class with a private field 'value'

Open fketchakeu opened this issue 1 year ago • 3 comments

Vue version

3.2.47

Link to minimal reproduction

https://play.vuejs.org/#eNp9kE9PwzAMxb+K5cs2aRpCcBrbpIJ2gAOgwTGXqnNLRppE+dNVqvrdcVN1cEDLKfJ7fv7ZHWbWrppIuMaNL5y0ATyFaEHlutoKDF7gTmhZW+MCdOCoXMKBSuihdKaGGffOHoQWulC595BBJzTws042eSBochUJtnDLpj75jPYB2vWQssl2LHHmXNMZsvliwa7NzQjCY3HJANxQymp18kYzZYoXWJjaSkXuzQbJgQLX02CBuVLm/JJqwUVaTvXii4rvf+on3w41ge+OPLmGBF60kLuKwijvP16p5f9FrM0xKnZfEQ/kjYoD42h7jPrI2H98ifY53Vfq6tPv20DaT0sNoIOzT36BfO6nK6v/4t6t7lMfXx37HzW3nrw=

Steps to reproduce

import { ref, Ref } from 'vue';

class A {
    private value = 1;
}

const x: Ref<A> = ref(new A());

What is expected?

No type errors

What is actually happening?

A type error as follows:

Type 'Ref<{}>' is not assignable to type 'Ref<UUID>'.

  Property 'value' is missing in type '{}' but required in type 'A'.

System Info

Binaries:
    Node: 18.19.1 - ~/.nvm/versions/node/v18.19.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v18.19.1/bin/npm
  Browsers:
    Chrome: 122.0.6261.111
    Edge: 122.0.2365.63
    Safari: 17.3.1

Any additional comments?

No response

fketchakeu avatar Mar 07 '24 17:03 fketchakeu