cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

getComponent() can't support abstract class.

Open finscn opened this issue 1 year ago • 1 comments

Cocos Creator version

3.8.1

System information

all

Issue description

getComponent() can't support abstract class.

2.4.x has support this feature.

Relevant error log output

No response

Steps to reproduce

node.getComponent(OneAbstractClass) , vscode reports error message.

Minimal reproduction project

No response

finscn avatar Dec 12 '23 06:12 finscn

看了下cc.d.ts 你们对 _types_globals__AbstractedConstructor 的定义错误, 缺少了关键字 abstract

应该是

        export type _types_globals__AbstractedConstructor<T = unknown> = abstract new (...args: any[]) => T;

finscn avatar Dec 12 '23 06:12 finscn