feat(types): expose DeepReadonly type (#1606)

This commit is contained in:
Pick 2020-07-17 21:28:50 +08:00 committed by GitHub
parent 622d042c6e
commit 527c2c8bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -22,7 +22,8 @@ export {
shallowReadonly,
markRaw,
toRaw,
ReactiveFlags
ReactiveFlags,
DeepReadonly
} from './reactive'
export {
computed,

View File

@ -74,7 +74,7 @@ export function shallowReactive<T extends object>(target: T): T {
type Primitive = string | number | boolean | bigint | symbol | undefined | null
type Builtin = Primitive | Function | Date | Error | RegExp
type DeepReadonly<T> = T extends Builtin
export type DeepReadonly<T> = T extends Builtin
? T
: T extends Map<infer K, infer V>
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>