Skip to content

cannot pass extra arguments to setTimeout() & friends  #1633

@alexlamsl

Description

@alexlamsl

What version of Bun is running?

--canary

What platform is your computer?

Linux 5.15.0-56-generic x86_64 x86_64

What steps can reproduce the bug?

$ cat test.js
setTimeout(function() {
  console.log(arguments.length, ...arguments);
}, 0, "arg1", "arg2");

What is the expected behavior?

$ node test.js
2 arg1 arg2

What do you see instead?

$ bun test.js
0

Additional information

Same goes for setImmediate():

$ cat test-immediate.js
setImmediate(function() {
  console.log(arguments.length, ...arguments);
}, "arg1", "arg2");
$ node test-immediate.js
2 arg1 arg2
$ bun test-immediate.js
0

whereas process.nextTick() differs... differently 😅

$ cat test-tick.js
process.nextTick(function() {
  console.log(arguments.length, ...arguments);
}, "arg1", "arg2");
$ node test-tick.js
2 arg1 arg2
$ bun test-tick.js
3 arg1 arg2 undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions