I'm trying to use https://www.npmjs.com/package/xvfb (commonJS) in an ESM script I'm writing
I tried doing something like
async function main() {
const Xvfb = (await import('xvfb')).default;
const xvfb = new Xvfb({ reuse: true, timeout: 30000, silent: true });
xvfb.startSync();
}```
I however ran into a few errors
```js
index.ts:52:30 - error TS7016: Could not find a declaration file for module 'xvfb'. 'project/node_modules/xvfb/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/xvfb` if it exists or add a new declaration (.d.ts) file containing `declare module 'xvfb';`
52 const Xvfb = (await import('xvfb')).default;
~~~~~~
node_modules/long/umd/index.d.ts:1:18 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead.
1 import Long from "../index.js";
~~~~~~~~~~~~~
Found 2 errors in 2 files.
Errors Files
1 index.ts:52
1 node_modules/long/umd/index.d.ts:1```
I managed to find a types file that someone wrote in the past and with a bit of modification I got