Skip to content

import { Hono } from 'jsr:@hono/hono' in Deno? #36

@tsalsa919

Description

@tsalsa919

In the README.md at https://jsr.io/@jcs224/hono-sessions#deno-1

For deno, it specifically using import { Hono } from 'npm:hono'

Using
import { Hono } from 'jsr:@hono/hono'

caused following errors:

Is it just for now we are to use npm:hono for Deno?

    Argument of type 'MiddlewareHandler' is not assignable to parameter of type 'MiddlewareHandler<{ Variables: { session: Session<SessionDataTypes>; session_key_rotation: boolean; }; }, "*", {}>'.
      Types of parameters 'c' and 'c' are incompatible.
        Type 'Context<{ Variables: { session: Session<SessionDataTypes>; session_key_rotation: boolean; }; }, "*", {}>' is not assignable to type 'Context<any, string, {}>'.
          The types of 'req.matchedRoutes' are incompatible between these types.
            Type 'import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").RouterRoute[]' is not assignable to type 'import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").RouterRoute[]'.
              Type 'import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").RouterRoute' is not assignable to type 'import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").RouterRoute'.
                Types of property 'handler' are incompatible.
                  Type 'import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").H<any, any, import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").BlankInput, any>' is not assignable to type 'import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").H<any, any, import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").BlankInput, any>'.
                    Type 'Handler<any, any, BlankInput, any>' is not assignable to type 'H<any, any, BlankInput, any>'.
                      Type 'import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").Handler<any, any, import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").BlankInput, any>' is not assignable to type 'import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").Handler<any, any, import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").BlankInput, any>'.
                        Types of parameters 'c' and 'c' are incompatible.
                          Property '#private' is missing in type 'import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/context.d.ts").Context<any, any, import("file:///Library/Caches/deno/npm/registry.npmjs.org/hono/4.9.8/dist/types/types.d.ts").BlankInput>' but required in type 'import("https://jsr.io/@hono/hono/4.9.8/src/context.ts").Context<any, any, import("https://jsr.io/@hono/hono/4.9.8/src/types.ts").BlankInput>'.
app.use('*', sessionMiddleware({
             ^
    at file:///testsession/index.ts:23:14

    '#private' is declared here.
      #private!: unknown;
      ~~~~~~~~
        at https://jsr.io/@hono/hono/4.9.8/src/context.ts:281:13TS2771 [ERROR]:     The last overload is declared here.
      <P extends string, E2 extends Env = E>(path: P, ...handlers: MiddlewareHandler<E2, MergePath<BasePath, P>>[]) : HonoBase<E, S, BasePath>;
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        at https://jsr.io/@hono/hono/4.9.8/src/types.ts:1055:5

error: Type checking failed.

  info: The program failed type-checking, but it still might work correctly.
  hint: Re-run with --no-check to skip type-checking.

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