Ref sugar type error
Version
3.2.6
Reproduction link
Steps to reproduce
Copy to VSCode and enable Volar
What is expected?
fix this error
What is actually happening?
type RefValue<T> = T & { [RefMarker]?: any };
If & { [RefMarker]?: any };
is removed, the issue is just fixed.
By the way I added ref types, but it doesn't working.
node_modules/vue/ref-macros.d.ts
seems doesn't exist.
Another problem:
import { ref } from 'vue';
let ref1 = $(ref()); // any
let ref2 = $ref();
// {
// [RefMarker]?: any;
// }
ref1 = 'hello world';
ref2 = 'hello world';
// 类型“"hello world"”与类型“{ [RefMarker]?: any; }”不具有相同的属性。ts(2559)
console.log(ref1, ref2);
because 'vue-next/packages/vue/package.json' files not includes 'ref-macros.d.ts', so npm store not have this file
@orziz yes, same for me, seems the
/// <reference types="vue/ref-macros" />
in env.d.ts doesn't fix TS errors
@orziz yes, same for me, seems the
/// <reference types="vue/ref-macros" />
in env.d.ts doesn't fix TS errors
same problem,the file is hasn't export ,but you can copy from https://github.com/vuejs/vue-next/blob/master/packages/vue/ref-macros.d.ts and create ref-macros.d.ts file in local
Seeing the same thing as @zct1989, no ref-macros anywhere in node_modules
manually adding the file myself clears everything up.
Hi, @yyx990803 Sorry to disturb you, but the type of problem I mentioned above doesn't seem to be fixed.