awslabs / aws-jwt-verify

JS library for verifying JWTs signed by Amazon Cognito, and any OIDC-compatible IDP that signs JWTs with RS256, RS384, and RS512
Apache License 2.0
598 stars 43 forks source link

[BUG] Could not find a declaration file for module 'aws-jwt-verify'. #100

Closed enheit closed 1 year ago

enheit commented 1 year ago

Describe the bug https://stackoverflow.com/questions/74872904/could-not-find-a-declaration-file-for-module-aws-jwt-verify

Versions Which version of aws-jwt-verify are you using?

3.2.0

Are you using the library in Node.js or in the Web browser?

Node.js

If Node.js, which version of Node.js are you using? (Should be at least 14)

v18.10.0

If using TypeScript, which version of TypeScript are you using? (Should be at least 4)

^4.9.3

To Reproduce If you can, please provide a minimal code example that reproduces the bug.

image

ottokruse commented 1 year ago

Thanks for the report!

Setting "moduleResolution" to "Node" solves this. We'll have to investigate why "NodeNext" doesn't work.

ottokruse commented 1 year ago

Having looked a bit deeper, I suspect this is a bug in TypeScript, so I created an issue there: https://github.com/microsoft/TypeScript/issues/51996

I hope they'll look at it but they might not as they don't like poking in external libraries.

We need to establish what the rules are for looking up declaration files (*.d.ts) under moduleResolution NodeNext. It seems to be different than under moduleResolution Node. This might be deliberate on their end, or a bug.

Had a look at the TypeScript docs, but they don't yet reveal any insights to me.

ottokruse commented 1 year ago

We need to establish what the rules are for looking up declaration files (*.d.ts) under moduleResolution NodeNext. It seems to be different than under moduleResolution Node. This might be deliberate on their end, or a bug.

TS now wants the "types" to be pointed to from entries in the "exports" object.

ottokruse commented 1 year ago

Fixed in v3.3.0