mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
Fix editor extendable (#8782)
* Fix editor extendable * Update editor-extendable.ts * Update editor-extendable.ts
This commit is contained in:
committed by
GitHub
parent
dbfcdd04e7
commit
b8bed774df
@@ -21,7 +21,7 @@ export function EditorExtendableMixin<T> (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<typeof EditorExtendable>;
|
||||
|
||||
@@ -30,7 +30,7 @@ function editorExtendableInternal<T> (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<T> (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}.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user