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}.`); } }