fix: getBoundSuper() 兼容

This commit is contained in:
YangFong 2023-08-15 10:36:42 +08:00
parent 2e508bdd73
commit 933858c1dd

View File

@ -2,7 +2,9 @@ const {defineProperty, getPrototypeOf} = Object;
// 简写 // 简写
type Fn = Function type Fn = Function
type SuperStore = WeakMap<Fn, Fn> // FIXME 正确写法,但过不了检查,暂时使用 any 兼容
// type SuperStore = WeakMap<Fn, Fn>
type SuperStore = WeakMap<Fn, any>
export function bind(fn: Fn, thisArg: any): Fn { export function bind(fn: Fn, thisArg: any): Fn {
if (fn.bind) { if (fn.bind) {
@ -37,7 +39,7 @@ function getBoundSuper(obj: Object, fn: Fn) {
superStore.set(fn, bind(fn, obj)); superStore.set(fn, bind(fn, obj));
} }
return superStore.get(fn) as Fn; return superStore.get(fn);
} }
function createDefaultSetter(key: string) { function createDefaultSetter(key: string) {