types: Use unique symbol type for _isRef property of ref object (#118)
This commit is contained in:
parent
caa9297da6
commit
f58e5e96f2
@ -78,6 +78,7 @@ describe('reactivity/ref', () => {
|
||||
expect(isRef(computed(() => 1))).toBe(true)
|
||||
|
||||
expect(isRef(0)).toBe(false)
|
||||
expect(isRef(1)).toBe(false)
|
||||
// an object that looks like a ref isn't necessarily a ref
|
||||
expect(isRef({ value: 0 })).toBe(false)
|
||||
})
|
||||
|
@ -131,7 +131,7 @@ export function track(
|
||||
targetMap.set(target, (depsMap = new Map()))
|
||||
}
|
||||
let dep = depsMap.get(key!)
|
||||
if (!dep) {
|
||||
if (dep === void 0) {
|
||||
depsMap.set(key!, (dep = new Set()))
|
||||
}
|
||||
if (!dep.has(effect)) {
|
||||
|
@ -4,9 +4,10 @@ import { isObject } from '@vue/shared'
|
||||
import { reactive } from './reactive'
|
||||
|
||||
export const refSymbol = Symbol()
|
||||
export type RefSymbol = typeof refSymbol
|
||||
|
||||
export interface Ref<T> {
|
||||
_isRef: symbol
|
||||
_isRef: RefSymbol
|
||||
value: UnwrapNestedRefs<T>
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user