types: massive refactor
This commit is contained in:
@@ -13,7 +13,7 @@ import { makeMap } from '@vue/shared'
|
||||
// which maintains a Set of subscribers, but we simply store them as
|
||||
// raw Sets to reduce memory overhead.
|
||||
export type Dep = Set<ReactiveEffect>
|
||||
export type KeyToDepMap = Map<string | symbol, Dep>
|
||||
export type KeyToDepMap = Map<any, Dep>
|
||||
export const targetMap = new WeakMap<any, KeyToDepMap>()
|
||||
|
||||
// WeakMaps that store {raw <-> observed} pairs.
|
||||
@@ -83,7 +83,7 @@ export function readonly<T extends object>(
|
||||
}
|
||||
|
||||
function createReactiveObject(
|
||||
target: any,
|
||||
target: unknown,
|
||||
toProxy: WeakMap<any, any>,
|
||||
toRaw: WeakMap<any, any>,
|
||||
baseHandlers: ProxyHandler<any>,
|
||||
@@ -120,11 +120,11 @@ function createReactiveObject(
|
||||
return observed
|
||||
}
|
||||
|
||||
export function isReactive(value: any): boolean {
|
||||
export function isReactive(value: unknown): boolean {
|
||||
return reactiveToRaw.has(value) || readonlyToRaw.has(value)
|
||||
}
|
||||
|
||||
export function isReadonly(value: any): boolean {
|
||||
export function isReadonly(value: unknown): boolean {
|
||||
return readonlyToRaw.has(value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user