You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a trick to using this module in a Typescript project?
import Semaphore from 'semaphore-async-await';
const lock = new Semaphore(1);
TypeError: Semaphore is not a constructor
I was able to work around the issue by changing the import statement to this, but it seems a bit dodgy:
import SemaphoreModule from 'semaphore-async-await';
// Not sure why we need to do it this way...
const Semaphore = (SemaphoreModule as any)['default'];
const lock = new Semaphore(1); // works now
Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
It looks like the issue is around module handling. If my code isn't a module then it seems to work, but once I configure it to work as a module that's when it seems to dislike the Semaphore constructor.
Is there a trick to using this module in a Typescript project?
I was able to work around the issue by changing the
import
statement to this, but it seems a bit dodgy:Am I doing something wrong?
The text was updated successfully, but these errors were encountered: