auth0 / node-jwks-rsa

A library to retrieve RSA public keys from a JWKS (JSON Web Key Set) endpoint.
MIT License
836 stars 236 forks source link

Fix: Typescript error Module can only be default-imported using the 'esModuleInterop' flag #309

Closed nickgvt closed 2 years ago

nickgvt commented 2 years ago

Describe the problem

There was a recent patch release for types change in index.d.ts file, which is causing as error:

TS 1259: Module '"/node_modules/@types/express/index"' can only be default-imported using the 'esModuleInterop' flag
4 import Express from 'express'
         ~~~~~~~

  node_modules/@types/express/index.d.ts:133:1
    133 export = e;
        ~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

This seems to be related to https://github.com/auth0/node-jwks-rsa/issues/305

Expected behavior

I would like to be able to build my project without needing to add a typescript flag and change all my existing imports

Reproduction

This tsconfig file looks like this

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "ES2019",
    }
}

Environment

maplesteve commented 2 years ago

Our builds are also failing since v2.1.2 due to the change in #305.

kirillgroshkov commented 2 years ago

Same for us. Pinned to 2.1.1 until it's fixed.