Skip to content

Commit 0462f86

Browse files
committed
types: use Builtin instead of Function and Date
1 parent 94a81b6 commit 0462f86

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/reactivity/src/reactive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export function shallowReactive<T extends object>(
141141
}
142142

143143
type Primitive = string | number | boolean | bigint | symbol | undefined | null
144-
type Builtin = Primitive | Function | Date | Error | RegExp
144+
export type Builtin = Primitive | Function | Date | Error | RegExp
145145
export type DeepReadonly<T> = T extends Builtin
146146
? T
147147
: T extends Map<infer K, infer V>

packages/reactivity/src/ref.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
isReadonly,
1616
isShallow
1717
} from './reactive'
18-
import type { ShallowReactiveMarker } from './reactive'
18+
import type { Builtin, ShallowReactiveMarker } from './reactive'
1919
import { CollectionTypes } from './collectionHandlers'
2020
import { createDep, Dep } from './dep'
2121

@@ -138,10 +138,7 @@ class RefImpl<T> {
138138
public dep?: Dep = undefined
139139
public readonly __v_isRef = true
140140

141-
constructor(
142-
value: T,
143-
public readonly __v_isShallow: boolean
144-
) {
141+
constructor(value: T, public readonly __v_isShallow: boolean) {
145142
this._rawValue = __v_isShallow ? value : toRaw(value)
146143
this._value = __v_isShallow ? value : toReactive(value)
147144
}
@@ -491,8 +488,7 @@ export type UnwrapRef<T> = T extends ShallowRef<infer V>
491488
: UnwrapRefSimple<T>
492489

493490
export type UnwrapRefSimple<T> = T extends
494-
| Function
495-
| Date
491+
| Builtin
496492
| CollectionTypes
497493
| BaseTypes
498494
| Ref

0 commit comments

Comments
 (0)