Skip to content

how to fix the typescript error from app.use('*', sessionMiddleware(... #18

@bkerin

Description

@bkerin

The home page said it might happen and shows how to ts-ignore, but I'd sort of like to know what it means and maybe how to fix it. For me without the ts-ignore deno says:

error: TS2769 [ERROR]: No overload matches this call.
  The last overload gave the following error.
    Argument of type 'MiddlewareHandler' is not assignable to parameter of type 'MiddlewareHandler<{ Variables: { session: Session; session_key_rotation: boolean; }; }, "*", {}>'.
      Types of parameters 'c' and 'c' are incompatible.
        Type 'Context<{ Variables: { session: Session; session_key_rotation: boolean; }; }, "*", {}>' is not assignable to type 'Context<any, string, {}>'.
          Property '#private' in type 'Context' refers to a different member that cannot be accessed from within type 'Context'.
app.use('*', sessionMiddleware({
             ^
    at file:///home/bkerin/projects/test/web_server/deno_tsx_test.tsx:159:14

I'm pretty new to typescript and have to admit I find this pretty hard to decipher especially the mismatch between type 'Context' ... with type 'Context' bit. Any clues?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions