-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package not working with typescipt? #242
Comments
@gyszalai can you share |
@gyszalai I was able to confirm that it works with: node.js: 18.17.1 The issue is somewhere on the application level, very likely in your |
Hi @mristic505! Thank you for your help! My tsconfig: {
"extends": "fastify-tsconfig",
"compilerOptions": {
"outDir": "dist",
"sourceMap": true
},
"include": ["src/**/*.ts"]
} |
I created my tsconfig according to the documentation of |
I am able to confirm that |
@mristic505 Thanks for your efforts! |
Thank you for replicating the issue. The problem disappears once you remove |
Closing this issue due to our conclusion that it is not due to the package but due to application settings in the provided example. It works when using both We are able to confirm that the package works with typescript. Please open a new issue if you keep experiencing problems and you still think that it is due to |
@mristic505 thank you for your help! |
For those who can't easily remove import buildGetJwks, { type GetJwksOptions, type GetJwks} from 'get-jwks`
type BuildGetJwksType = (options?: GetJwksOptions) => GetJwks
// type casting incantation avoids errors when using ESM
const getJwks = (buildGetJwks as unknown as BuildGetJwksType)({...}) It seems the issue is that TypeScript can't figure out the type of
If you call |
@jmjf our earlier investigation suggested that this wasn't an issue with the package, but with the way it was being used. If you think it's instead an issue with the package and the typings, I'm happy to reopen the issue. |
After a bike ride :), I tried this in the work project where I ran into this issue. That project is set up to use ESM, so I created two identical files, one named // getJwks.mjs and getJwks.ts
import buildGetJwks from 'get-jwks';
export const getJwks = buildGetJwks(); I ran each file with // tsnode.mjs
import {register} from 'node:module'
import {pathToFileURL} from 'node:url'
register('ts-node/esm', pathToFileURL('./')) When I run I think that says this is a TypeScript problem or an ESM + TypeScript problem. So I thought, "Well, So I hacked declare function buildGetJwks(options?: GetJwksOptions): GetJwks
export = buildGetJwks Now both |
@jmjf would you be so kind as to send a PR too? You've done all the heavy lifting already it seems :) |
Sure. Will set that up this weekend. 🤗
…On Fri, Jun 21, 2024, 12:32 Simone Busoli ***@***.***> wrote:
@jmjf <https://github.com/jmjf> would you be so kind as to send a PR too?
You've done all the heavy lifting already it seems :)
—
Reply to this email directly, view it on GitHub
<#242 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASIV6ZYT66G4ZDSUGUVQFLZIRIQ3AVCNFSM6AAAAABJV6J74WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBTGA3TCNZTGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
And I just saw this in Node Weekly.
https://arethetypeswrong.github.io/?p=get-jwks%409.0.1
Which reports the problem the PR should fix.
…On Fri, Jun 21, 2024, 12:39 Jamee Mikell ***@***.***> wrote:
Sure. Will set that up this weekend. 🤗
On Fri, Jun 21, 2024, 12:32 Simone Busoli ***@***.***>
wrote:
> @jmjf <https://github.com/jmjf> would you be so kind as to send a PR
> too? You've done all the heavy lifting already it seems :)
>
> —
> Reply to this email directly, view it on GitHub
> <#242 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AASIV6ZYT66G4ZDSUGUVQFLZIRIQ3AVCNFSM6AAAAABJV6J74WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBTGA3TCNZTGM>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
🎉 This issue has been resolved in version 9.0.2 🎉 The release is available on: Your optic bot 📦🚀 |
And arethetypeswrong agrees. 🥳
…On Mon, Jun 24, 2024, 11:25 github-actions[bot] ***@***.***> wrote:
🎉 This issue has been resolved in version 9.0.2 🎉
The release is available on:
- npm package <https://www.npmjs.com/package/get-jwks/v/9.0.2>
- GitHub release
<https://github.com/nearform/get-jwks/releases/tag/v9.0.2>
Your *optic
<https://github.com/nearform-actions/optic-release-automation-action>*
bot 📦🚀
—
Reply to this email directly, view it on GitHub
<#242 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASIV664MHHE7D357TEG7QLZJA25VAVCNFSM6AAAAABJV6J74WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWHA2DAMJSGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi all!
I'm trying to use this package from typescript like this:
and when I try to compile the typescript code, I get the following error:
node.js: 20.8.0 and 18.17.1
typescript: 5.2.2
pnpm: 8.8.0
Am I doing something wrong or is this module not compatible with either node 18/20 or typescript 5.2?
Please help me! Thank you in advance!
The text was updated successfully, but these errors were encountered: