elysiajs / elysia-jwt

Plugin for Elysia for using JWT Authentication
MIT License
41 stars 16 forks source link

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

Open Wuyuh-sun opened 1 year ago

Wuyuh-sun commented 1 year ago

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 commented 1 year ago

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 commented 12 months ago

Yep having same issue

image
gabbrieu commented 11 months ago

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

gabbrieu commented 11 months ago

Problem still persists with 0.7.28

farhan-syah commented 11 months ago

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