From: djy0 Date: Mon, 9 Mar 2020 20:01:49 +0000 (+0800) Subject: types(reactivity): remove this in get accessor, fix #800 (#806) X-Git-Tag: v3.0.0-alpha.9~50 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b13886b1ba886a0133380d191a97dcadf18fb15e;p=thirdparty%2Fvuejs%2Fcore.git types(reactivity): remove this in get accessor, fix #800 (#806) --- diff --git a/packages/reactivity/src/baseHandlers.ts b/packages/reactivity/src/baseHandlers.ts index 932f4ebec0..4d5ec50f73 100644 --- a/packages/reactivity/src/baseHandlers.ts +++ b/packages/reactivity/src/baseHandlers.ts @@ -23,7 +23,7 @@ const arrayInstrumentations: Record = {} for (let i = 0, l = (this as any).length; i < l; 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) if (res === -1 || res === false) { // if that didn't work, run it again using raw values. diff --git a/packages/reactivity/src/collectionHandlers.ts b/packages/reactivity/src/collectionHandlers.ts index e173ce302d..07ad0144ad 100644 --- a/packages/reactivity/src/collectionHandlers.ts +++ b/packages/reactivity/src/collectionHandlers.ts @@ -200,8 +200,8 @@ const readonlyInstrumentations: Record = { get(this: MapTypes, key: unknown) { return get(this, key, toReadonly) }, - get size(this: IterableCollections) { - return size(this) + get size() { + return size((this as unknown) as IterableCollections) }, has, add: createReadonlyMethod(add, TriggerOpTypes.ADD),