SBoudrias/Inquirer.js

[Bug] TypeError: Cannot call a class constructor without |new|

nandin-borjigin opened this issue · 1 comments

120 | 
121 | class AsyncResource {
122 |   type;
123 |   #snapshot;
124 | 
125 |   constructor(type, options) {
                             ^
TypeError: Cannot call a class constructor without |new|
      at AsyncResource (node:async_hooks:125:26)
      at run (<project_dir>/node_modules/@inquirer/core/dist/esm/lib/hook-engine.mjs:87:13)
      at workLoop (<project_dir>/node_modules/@inquirer/core/dist/esm/lib/create-prompt.mjs:77:24)
      at <project_dir>/node_modules/@inquirer/core/dist/esm/lib/create-prompt.mjs:86:20

Environment:

  • Mac Studio (Apple M1 Max)
  • macOS 13.5.2 (22G91)
  • bun 1.0.2 (not Node.js)
  • @inquirer/checkbox 1.3.11 (1.3.8 works without problem)

Introduced by 8a39c69

Culprit: withUpdates return a bound version of AsyncResource constructor but it is called without new

withUpdates(() => {
store.hooksEffect.forEach((effect) => {
effect();
});
})();

It's rather a bun issue

oven-sh/bun#4787