Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setInterval和setTimeout参数rest只能传一个。如果定时器回掉函数是多个的话,就不行了 #323

Open
onlyliujiangtao opened this issue May 24, 2024 · 0 comments

Comments

@onlyliujiangtao
Copy link

declare function setInterval(
    /** 回调函数 */
    callback: (...args: any[]) => any,
    /** 执行回调函数之间的时间间隔,单位 ms。 */
    delay?: number,
    /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
    rest?: any
): number
/** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html)
 *
 * 设定一个定时器。在定时到期以后执行注册的回调函数 */
declare function setTimeout(
    /** 回调函数 */
    callback: (...args: any[]) => any,
    /** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
    delay?: number,
    /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
    rest?: any
): number

image

应该改成这样

    /** 回调函数 */
    callback: (...args: any[]) => any,
    /** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
    delay?: number,
    /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
    ...rest: any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant