sinonjs / fake-timers

Fake setTimeout and friends (collectively known as "timers"). Useful in your JavaScript tests. Extracted from Sinon.JS
BSD 3-Clause "New" or "Revised" License
797 stars 104 forks source link

Cannot find name 'queueMicrotask' #389

Closed minche-tsai closed 3 years ago

minche-tsai commented 3 years ago

node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:11:28 - error TS2304: Cannot find name 'queueMicrotask'.

11 queueMicrotask: typeof queueMicrotask;

The package aws-sdk-client-mock is use sinonjs to mock aws-sdk v3. when I use jest to test have this error message.

This article is same problem, but not me. https://stackoverflow.com/questions/67761159/fake-timers-7-1-x-compile-error-cannot-find-name-queuemicrotask

fatso83 commented 3 years ago

Due to various issues, we have decided to drop the TS definitions, so a short term fix is to just install fake-timers v6 and the types from DT. See also https://github.com/sinonjs/fake-timers/issues/387#issuecomment-858133528.

minche-tsai commented 3 years ago

I has found problem, the queueMicrotask is added in: node.js v11.0.0. But my @types/node is v10.x, so upgrade version was resolved.

tomoima525 commented 2 years ago

@minche-tsai

I has found problem, the queueMicrotask is added in: node.js v11.0.0. But my @types/node is v10.x, so upgrade version was resolved.

this resolved the issue, thanks!