}
type Primitive = string | number | boolean | bigint | symbol | undefined | null
-type Builtin = Primitive | Function | Date | Error | RegExp
+export type Builtin = Primitive | Function | Date | Error | RegExp
export type DeepReadonly<T> = T extends Builtin
? T
: T extends Map<infer K, infer V>
toRaw,
toReactive,
} from './reactive'
-import type { ShallowReactiveMarker } from './reactive'
+import type { Builtin, ShallowReactiveMarker } from './reactive'
import { type Dep, createDep } from './dep'
import { ComputedRefImpl } from './computed'
import { getDepFromReactive } from './reactiveEffect'
: (new ObjectRefImpl(source, key, defaultValue) as any)
}
-// corner case when use narrows type
-// Ex. type RelativePath = string & { __brand: unknown }
-// RelativePath extends object -> true
-type BaseTypes = string | number | boolean
-
/**
* This is a special exported interface for other packages to declare
* additional types that should bail out for ref unwrapping. For example
: UnwrapRefSimple<T>
export type UnwrapRefSimple<T> = T extends
- | Function
- | BaseTypes
+ | Builtin
| Ref
| RefUnwrapBailTypes[keyof RefUnwrapBailTypes]
| { [RawSymbol]?: true }
$set<T extends Record<keyof any, any>, K extends keyof T>(
target: T,
key: K,
- value: T[K]
+ value: T[K],
): void
$delete<T extends Record<keyof any, any>, K extends keyof T>(
target: T,
- key: K
+ key: K,
): void
$mount(el?: string | Element): this
$destroy(): void