@@ -47,8 +47,8 @@ const Settings = {
47
47
const Traps_self = Symbol ( ) ;
48
48
const Traps_target = Symbol ( ) ;
49
49
50
- export type Primitive < T > = T extends object ? T : never ;
51
- export type Prop = string | number | symbol ;
50
+ export type Primitive = null | undefined | boolean | number | string | symbol ;
51
+ export type Prop = number | string | symbol ;
52
52
export type UnknownObj = Record < Prop , unknown > ;
53
53
export type UnknownArr = Array < unknown > ;
54
54
export type UnknownMap = Map < unknown , unknown > ;
@@ -61,7 +61,7 @@ export type PatchCallback = (patches: Patch[], inversePatches: Patch[]) => void;
61
61
62
62
export type FreezeOnce < T > = T extends Freeze < infer Q > ? Freeze < Q > : Freeze < T > ;
63
63
64
- export type Freeze < T > = T extends Primitive < T >
64
+ export type Freeze < T > = T extends Primitive
65
65
? T
66
66
: T extends Array < infer U >
67
67
? ReadonlyArray < Freeze < U > >
@@ -75,7 +75,7 @@ export type Freeze<T> = T extends Primitive<T>
75
75
? ReadonlySet < Freeze < M > >
76
76
: { readonly [ K in keyof T ] : Freeze < T [ K ] > } ;
77
77
78
- export type UnFreeze < T > = T extends Primitive < T >
78
+ export type UnFreeze < T > = T extends Primitive
79
79
? T
80
80
: T extends Array < infer Q >
81
81
? Array < UnFreeze < Q > >
@@ -622,7 +622,7 @@ export function applyPatch<T extends object>(
622
622
}
623
623
}
624
624
625
- function isPrimitive < T > ( x : unknown ) : x is Primitive < T > {
625
+ function isPrimitive ( x : unknown ) : x is Primitive {
626
626
if ( x === null ) return true ;
627
627
const type = typeof x ;
628
628
if ( type !== Types . function && type !== Types . object ) return true ;
@@ -671,7 +671,7 @@ function shallowClone<T>(x: T, type?: Types): object {
671
671
}
672
672
673
673
const cloneTypes : Partial < Record < Types , Function > > = {
674
- [ Types . primitive ] < T > ( x : Primitive < T > ) {
674
+ [ Types . primitive ] ( x : Primitive ) {
675
675
return x ;
676
676
} ,
677
677
[ Types . Object ] ( x : Object ) {
0 commit comments