From: Pick Date: Fri, 17 Jul 2020 13:28:50 +0000 (+0800) Subject: feat(types): expose DeepReadonly type (#1606) X-Git-Tag: v3.0.0-rc.1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=527c2c8bbb5c8fcfdf827dd985a09d7e7388cdad;p=thirdparty%2Fvuejs%2Fcore.git feat(types): expose DeepReadonly type (#1606) --- diff --git a/packages/reactivity/src/index.ts b/packages/reactivity/src/index.ts index bbab3118a8..aaf5324259 100644 --- a/packages/reactivity/src/index.ts +++ b/packages/reactivity/src/index.ts @@ -22,7 +22,8 @@ export { shallowReadonly, markRaw, toRaw, - ReactiveFlags + ReactiveFlags, + DeepReadonly } from './reactive' export { computed, diff --git a/packages/reactivity/src/reactive.ts b/packages/reactivity/src/reactive.ts index 1f01c393d0..383701521e 100644 --- a/packages/reactivity/src/reactive.ts +++ b/packages/reactivity/src/reactive.ts @@ -74,7 +74,7 @@ export function shallowReactive(target: T): T { type Primitive = string | number | boolean | bigint | symbol | undefined | null type Builtin = Primitive | Function | Date | Error | RegExp -type DeepReadonly = T extends Builtin +export type DeepReadonly = T extends Builtin ? T : T extends Map ? ReadonlyMap, DeepReadonly>