Skip to content

Commit

Permalink
feat(types): expose DeepReadonly type (#1606)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pick authored Jul 17, 2020
1 parent 622d042 commit 527c2c8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/reactivity/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export {
shallowReadonly,
markRaw,
toRaw,
ReactiveFlags
ReactiveFlags,
DeepReadonly
} from './reactive'
export {
computed,
Expand Down
2 changes: 1 addition & 1 deletion packages/reactivity/src/reactive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
Expand Down

0 comments on commit 527c2c8

Please sign in to comment.