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

about cc.d.ts : Please add defalut <T> to Tween

Open finscn opened this issue 1 year ago • 0 comments

Use Case

current declare is :

export class Tween<T> { ... } 

when I define a var , I have to use let foo : cc.Tween<OneType>

but in most cases , the APIs of cc.Tween (eg. foo.stop() foo.satrt() foo.timeScale ...) don't care about the genericity . and the var foo may be used for many different tween instances, like this

// method 1
if (foo) {
 foo.stop()
}
foo = cc.tween<TypeA>(......)

// method 2
if (foo) {
 foo.stop()
}
foo = cc.tween<TypeB>(......)

so I hope there could be a default value of T . like this

export class Tween<T = any> { ... } 

Problem Description

none

Proposed Solution

No response

How it works

No response

Alternatives Considered

none

Additional Information

No response

finscn avatar Feb 21 '24 05:02 finscn