From b8bed774df57d1ca3c2111fcbd0dd1f7d2cca4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Tue, 8 Jun 2021 11:27:54 +0800 Subject: [PATCH] Fix editor extendable (#8782) * Fix editor extendable * Update editor-extendable.ts * Update editor-extendable.ts --- cocos/core/data/editor-extendable.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos/core/data/editor-extendable.ts b/cocos/core/data/editor-extendable.ts index 06776025af..04bc947f95 100644 --- a/cocos/core/data/editor-extendable.ts +++ b/cocos/core/data/editor-extendable.ts @@ -21,7 +21,7 @@ export function EditorExtendableMixin (Base: new (...args: any[]) => T, class /** * Class which implements the `EditorExtendableObject` interface. */ -export const EditorExtendable = editorExtendableInternal(Object); +export const EditorExtendable = editorExtendableInternal(); export type EditorExtendable = InstanceType; @@ -30,7 +30,7 @@ function editorExtendableInternal (Base?: (new (...args: any[]) => T), classN type ResultType = new (...args: any[]) => (T & EditorExtendableObject); if (!EDITOR) { - return Base as unknown as ResultType; + return (Base ?? Object) as unknown as ResultType; } let name: string; @@ -43,7 +43,7 @@ function editorExtendableInternal (Base?: (new (...args: any[]) => T), classN if (baseName) { name = `cc.EditorExtendable/${baseName}`; } else { - throw new Error(`You should supply a class name to EditorExtendable.`); + throw new Error(`You should supply a class name to EditorExtendable when mixin with ${Base.name}.`); } }