Skip to content
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

The return type of jwt doesn't seem to work properly in version 0.7.1. #16

Open
Wuyuh-sun opened this issue Oct 26, 2023 · 5 comments
Open

Comments

@Wuyuh-sun
Copy link

Nice to meet you. I am a Korean preparing to become a developer.
We apologize for the inconvenience caused by raising the issue through a translator and ask for your understanding.

I am developing a personal blog through elysia with bun, and while using the @elysiajs/jwt^0.7.1 module, the name set in jwt is not properly entered into the decorate of the context.

Please check this issue and let me know the solution.

+++ It seems to work normally in version 0.6.1.

@Matoo125
Copy link

I'm having a similar issue. When

.use(
  jwt({
    name: 'jwt',
    // This should be Environment Variable
    secret: 'MY_SECRETS',
  })
)

I get the following:

No overload matches this call.
  The last overload gave the following error.
    Argument of type 'Elysia<"", { request: { jwt: { readonly sign: (morePayload: Record<string, string> & JWTPayloadSpec) => Promise<string>; readonly verify: (jwt?: string | undefined) => Promise<...>; }; }; store: {}; }, { ...; }, {}, {}, false>' is not assignable to parameter of type 'Promise<{ default: Elysia<any, any, any, any, any, any>; }>'.
      Type 'Elysia<"", { request: { jwt: { readonly sign: (morePayload: Record<string, string> & JWTPayloadSpec) => Promise<string>; readonly verify: (jwt?: string | undefined) => Promise<...>; }; }; store: {}; }, { ...; }, {}, {}, false>' is missing the following properties from type 'Promise<{ default: Elysia<any, any, any, any, any, any>; }>': then, catch, finally, [Symbol.toStringTag]ts(2769)
index.d.ts(392, 5): The last overload is declared here.

the same issue with .use(cookie())

@MariuzM
Copy link

MariuzM commented Nov 1, 2023

Yep having same issue
image

@gabbrieu
Copy link

gabbrieu commented Nov 10, 2023

Same issue here with 0.7.24 (the message is in Portuguese)
image

@gabbrieu
Copy link

Problem still persists with 0.7.28

@farhan-syah
Copy link

It seems the output file in the npm dist directory doesn't match the type. For the time being, i can solve this by:

  • Copy the code from src/index.ts and paste it into my own jwt.ts file and import from it instead from the npm package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants