Skip to content

Commit 57dc127

Browse files
committed
types: use Primitive to instead of BaseType
1 parent 9a0676c commit 57dc127

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

packages/reactivity/src/reactive.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,15 @@ export function shallowReactive<T extends object>(
140140
)
141141
}
142142

143-
type Primitive = string | number | boolean | bigint | symbol | undefined | null
144-
export type Builtin = Primitive | Function | Date | Error | RegExp
143+
export type Primitive =
144+
| string
145+
| number
146+
| boolean
147+
| bigint
148+
| symbol
149+
| undefined
150+
| null
151+
export type Builtin = Function | Date | Error | RegExp
145152
export type DeepReadonly<T> = T extends Builtin
146153
? T
147154
: T extends Map<infer K, infer V>

packages/reactivity/src/ref.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
isReadonly,
1717
isShallow
1818
} from './reactive'
19-
import type { Builtin, ShallowReactiveMarker } from './reactive'
19+
import type { Builtin, Primitive, ShallowReactiveMarker } from './reactive'
2020
import { createDep, Dep } from './dep'
2121

2222
declare const RefSymbol: unique symbol
@@ -484,6 +484,7 @@ export type UnwrapRef<T> = T extends ShallowRef<infer V>
484484
: UnwrapRefSimple<T>
485485

486486
export type UnwrapRefSimple<T> = T extends
487+
| Primitive
487488
| Builtin
488489
| Ref
489490
| RefUnwrapBailTypes[keyof RefUnwrapBailTypes]

0 commit comments

Comments
 (0)