feat(types): expose DeepReadonly type (#1606)
This commit is contained in:
parent
622d042c6e
commit
527c2c8bbb
@ -22,7 +22,8 @@ export {
|
|||||||
shallowReadonly,
|
shallowReadonly,
|
||||||
markRaw,
|
markRaw,
|
||||||
toRaw,
|
toRaw,
|
||||||
ReactiveFlags
|
ReactiveFlags,
|
||||||
|
DeepReadonly
|
||||||
} from './reactive'
|
} from './reactive'
|
||||||
export {
|
export {
|
||||||
computed,
|
computed,
|
||||||
|
@ -74,7 +74,7 @@ export function shallowReactive<T extends object>(target: T): T {
|
|||||||
|
|
||||||
type Primitive = string | number | boolean | bigint | symbol | undefined | null
|
type Primitive = string | number | boolean | bigint | symbol | undefined | null
|
||||||
type Builtin = Primitive | Function | Date | Error | RegExp
|
type Builtin = Primitive | Function | Date | Error | RegExp
|
||||||
type DeepReadonly<T> = T extends Builtin
|
export type DeepReadonly<T> = T extends Builtin
|
||||||
? T
|
? T
|
||||||
: T extends Map<infer K, infer V>
|
: T extends Map<infer K, infer V>
|
||||||
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
|
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
|
||||||
|
Loading…
Reference in New Issue
Block a user