refactor(ref-transform): use shallowRef to align with types

This commit is contained in:
Evan You
2021-08-24 09:20:32 -04:00
parent b40845153c
commit 8f1101c498
3 changed files with 33 additions and 33 deletions

View File

@@ -55,12 +55,12 @@ exports[`accessing ref binding 1`] = `
`;
exports[`array destructure 1`] = `
"import { ref as _ref } from 'vue'
"import { ref as _ref, shallowRef as _shallowRef } from 'vue'
let n = _ref(1), [__a, __b = 1, ...__c] = (useFoo())
const a = _ref(__a);
const b = _ref(__b);
const c = _ref(__c);
const a = _shallowRef(__a);
const b = _shallowRef(__b);
const c = _shallowRef(__c);
console.log(n.value, a.value, b.value, c.value)
"
`;
@@ -114,13 +114,13 @@ exports[`mutating ref binding 1`] = `
`;
exports[`nested destructure 1`] = `
"import { ref as _ref } from 'vue'
"import { shallowRef as _shallowRef } from 'vue'
let [{ a: { b: __b }}] = (useFoo())
const b = _ref(__b);
const b = _shallowRef(__b);
let { c: [__d, __e] } = (useBar())
const d = _ref(__d);
const e = _ref(__e);
const d = _shallowRef(__d);
const e = _shallowRef(__e);
console.log(b.value, d.value, e.value)
"
`;
@@ -163,16 +163,16 @@ exports[`nested scopes 1`] = `
`;
exports[`object destructure 1`] = `
"import { ref as _ref } from 'vue'
"import { ref as _ref, shallowRef as _shallowRef } from 'vue'
let n = _ref(1), { a: __a, b: __c, d: __d = 1, e: __f = 2, ...__g } = (useFoo())
const a = _ref(__a);
const c = _ref(__c);
const d = _ref(__d);
const f = _ref(__f);
const g = _ref(__g);
const a = _shallowRef(__a);
const c = _shallowRef(__c);
const d = _shallowRef(__d);
const f = _shallowRef(__f);
const g = _shallowRef(__g);
let { foo: __foo } = (useSomthing(() => 1));
const foo = _ref(__foo);
const foo = _shallowRef(__foo);
console.log(n.value, a.value, c.value, d.value, f.value, g.value, foo.value)
"
`;