danielwerg / r6api.js

🍫 Node.js wrapper around Rainbow Six Siege APIs
https://npm.im/r6api.js
MIT License
111 stars 19 forks source link

R6API class is under double default export #67

Closed BadCoder1337 closed 3 years ago

BadCoder1337 commented 3 years ago

I'm using r6api.js as ES Module

PS C:\Users\NO_RUSSIAN_SYMBOLS\Projects\temp> node
Welcome to Node.js v16.3.0.
Type ".help" for more information.
> import("r6api.js").then(m => r6api = m)
Promise { <pending> }
> r6api.default.default
[class R6API]

That prevents proper usage with TypeScript. Declarations have correct default export. ES6 usage from README works only with transpiler.

danielwerg commented 3 years ago

Could you provide an example from an actual project? I haven't had any issue in my ts projects. ESM stuff is confusing :/

BadCoder1337 commented 3 years ago

Just need two files

{
    "type": "module",
    "dependencies": {
        "r6api.js": "2.1.0"
    }
}

First string will be R6API [object Object] class R6API { ... }. R6API is not a class. R6API is already a default import, so R6API.default type is any causing a TS error.

Doesn't import propely in Node 12, 14, 16.