diff --git a/src/reactivity/ref.ts b/src/reactivity/ref.ts index 8d54be8b..9dfc2dc9 100644 --- a/src/reactivity/ref.ts +++ b/src/reactivity/ref.ts @@ -6,7 +6,9 @@ import { reactive } from './reactive'; type BailTypes = Function | Map | Set | WeakMap | WeakSet; +declare const _refBrand: unique symbol; export interface Ref { + readonly [_refBrand]: true; value: T; } @@ -86,6 +88,7 @@ interface RefOption { set?(x: T): void; } class RefImpl implements Ref { + readonly [_refBrand]!: true; public value!: T; constructor({ get, set }: RefOption) { proxy(this, 'value', { @@ -134,7 +137,7 @@ export function isRef(value: any): value is Ref { // prettier-ignore type Refs = { - [K in keyof Data]: Data[K] extends Ref + [K in keyof Data]: Data[K] extends Ref ? Ref : Ref }