types(reactivity): remove this in get accessor, fix #800 (#806)

This commit is contained in:
djy0 2020-03-10 04:01:49 +08:00 committed by GitHub
parent 257727569a
commit b13886b1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@ const arrayInstrumentations: Record<string, Function> = {}
for (let i = 0, l = (this as any).length; i < l; i++) { for (let i = 0, l = (this as any).length; i < l; i++) {
track(arr, TrackOpTypes.GET, i + '') track(arr, TrackOpTypes.GET, i + '')
} }
// we run the method using the orignal args first (which may be reactive) // we run the method using the original args first (which may be reactive)
const res = arr[key](...args) const res = arr[key](...args)
if (res === -1 || res === false) { if (res === -1 || res === false) {
// if that didn't work, run it again using raw values. // if that didn't work, run it again using raw values.

View File

@ -200,8 +200,8 @@ const readonlyInstrumentations: Record<string, Function> = {
get(this: MapTypes, key: unknown) { get(this: MapTypes, key: unknown) {
return get(this, key, toReadonly) return get(this, key, toReadonly)
}, },
get size(this: IterableCollections) { get size() {
return size(this) return size((this as unknown) as IterableCollections)
}, },
has, has,
add: createReadonlyMethod(add, TriggerOpTypes.ADD), add: createReadonlyMethod(add, TriggerOpTypes.ADD),