diff --git a/packages/reactivity/src/reactive.ts b/packages/reactivity/src/reactive.ts index 40edf1c8e3b..935b2deead5 100644 --- a/packages/reactivity/src/reactive.ts +++ b/packages/reactivity/src/reactive.ts @@ -140,8 +140,15 @@ export function shallowReactive( ) } -type Primitive = string | number | boolean | bigint | symbol | undefined | null -export type Builtin = Primitive | Function | Date | Error | RegExp +export type Primitive = + | string + | number + | boolean + | bigint + | symbol + | undefined + | null +export type Builtin = Function | Date | Error | RegExp export type DeepReadonly = T extends Builtin ? T : T extends Map diff --git a/packages/reactivity/src/ref.ts b/packages/reactivity/src/ref.ts index 92d0b6751b4..7a1c64eb9f7 100644 --- a/packages/reactivity/src/ref.ts +++ b/packages/reactivity/src/ref.ts @@ -16,7 +16,7 @@ import { isReadonly, isShallow } from './reactive' -import type { Builtin, ShallowReactiveMarker } from './reactive' +import type { Builtin, Primitive, ShallowReactiveMarker } from './reactive' import { createDep, Dep } from './dep' declare const RefSymbol: unique symbol @@ -484,6 +484,7 @@ export type UnwrapRef = T extends ShallowRef : UnwrapRefSimple export type UnwrapRefSimple = T extends + | Primitive | Builtin | Ref | RefUnwrapBailTypes[keyof RefUnwrapBailTypes]