Skip to content

Update collectionHandlers.ts #6577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/reactivity/src/collectionHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type IterableCollections = Map<any, any> | Set<any>
type WeakCollections = WeakMap<any, any> | WeakSet<any>
type MapTypes = Map<any, any> | WeakMap<any, any>
type SetTypes = Set<any> | WeakSet<any>

type instrumentationsType = Record<string, Function | number>
const toShallow = <T extends unknown>(value: T): T => value

const getProto = <T extends CollectionTypes>(v: T): any =>
Expand Down Expand Up @@ -228,7 +228,7 @@ function createReadonlyMethod(type: TriggerOpTypes): Function {
}

function createInstrumentations() {
const mutableInstrumentations: Record<string, Function> = {
const mutableInstrumentations: instrumentationsType = {
get(this: MapTypes, key: unknown) {
return get(this, key)
},
Expand All @@ -243,7 +243,7 @@ function createInstrumentations() {
forEach: createForEach(false, false)
}

const shallowInstrumentations: Record<string, Function> = {
const shallowInstrumentations: instrumentationsType = {
get(this: MapTypes, key: unknown) {
return get(this, key, false, true)
},
Expand All @@ -258,7 +258,7 @@ function createInstrumentations() {
forEach: createForEach(false, true)
}

const readonlyInstrumentations: Record<string, Function> = {
const readonlyInstrumentations: instrumentationsType = {
get(this: MapTypes, key: unknown) {
return get(this, key, true)
},
Expand All @@ -275,7 +275,7 @@ function createInstrumentations() {
forEach: createForEach(true, false)
}

const shallowReadonlyInstrumentations: Record<string, Function> = {
const shallowReadonlyInstrumentations: instrumentationsType = {
get(this: MapTypes, key: unknown) {
return get(this, key, true, true)
},
Expand Down