#nodenext resolution with commonjs dependencies

4 messages · Page 1 of 1 (latest)

mellow coral
#

Basically this:
https://www.typescriptlang.org/play?target=99&moduleResolution=99&module=199#code/JYWwDg9gTgLgBAZwIYFcDGBTOAzKERwDky6GANkgEYKEDcAUPWhAHYLwAeAXIqpnAF44LDAHdepABQBKWkA

whats going on here? saucelabs uses a 'fake' default export, i.e. module.exports.default = SauceLabs
its types define an export default SauceLabs (where declare class SauceLabs {} further up)

#

you can try hack around it by:

import saucelabs from 'saucelabs';

const sauce = saucelabs.default;

const x: sauce = new sauce(); // still fails on the type though since `default` isn't a type
#

i also can't then do const x: typeof sauce = new sauce(); because it thinks sauce has no prototype etc. absolutely baffled by whats going on here tbh

mellow coral
#

the share link got itself in a mess, you might have to pick nodenext manually