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

isolatedModule and responseTypeHeader error while running the sample code #8

Open
borsemayur2 opened this issue Apr 15, 2021 · 1 comment

Comments

@borsemayur2
Copy link

Code:

import { Application } from "https://deno.land/x/oak/mod.ts";

import { responseTimeHeader } from "https://deno.land/x/oak_middleware/observability/response_time_header.ts";
const app = new Application();

app.use(responseTimeHeader);

app.use((ctx: any, next: any) => {
  ctx.response.body = "Hello Oak!";
});
console.log("listening on port 8080");
app.listen({ port: 8080 });

I'm getting following errors:

TS1205 [ERROR]: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.

TS2724 [ERROR]: '"https://deno.land/x/[email protected]/observability/response_time_header.ts"' has no exported member named 'responseTimeHeader'. Did you mean 'responseTypeHeader'?
import { responseTimeHeader } from "https://deno.land/x/oak_middleware/observability/response_time_header.ts";

   'responseTypeHeader' is declared here.
    export const responseTypeHeader: Middleware = async function (ctx, next) {
                 ~~~~~~~~~~~~~~~~~~
        at https://deno.land/x/[email protected]/observability/response_time_header.ts:22:14

The code at deno.land still points to responseTypeHeader. This seems the issue for responseTypeHeader error.
image

@borsemayur2 borsemayur2 changed the title isolateModule and responseTypeHeader error while running the sample code isolatedModule and responseTypeHeader error while running the sample code Apr 15, 2021
@borsemayur2
Copy link
Author

github code version

import {responseTimeHeader} from "https://raw.githubusercontent.com/oakserver/middleware/main/observability/response_time_header.ts"

errors:

TS2345 [ERROR]: Argument of type 'import("https://deno.land/x/[email protected]/middleware.ts").Middleware<Record<string, any>, import("https://deno.land/x/[email protected]/context.ts").Context<Record<string, any>>>' is not assignable to parameter of type 'import("https://deno.land/x/[email protected]/middleware.ts").Middleware<Record<string, any>, import("https://deno.land/x/[email protected]/context.ts").Context<Record<string, any>>>'.
  Types of parameters 'context' and 'context' are incompatible.
    Type 'import("https://deno.land/x/[email protected]/context.ts").Context<Record<string, any>>' is not assignable to type 'import("https://deno.land/x/[email protected]/context.ts").Context<Record<string, any>>'.
      Types of property 'app' are incompatible.
        Type 'Application<State>' is not assignable to type 'Application<any>'.
          Property '#middleware' in type 'Application' refers to a different member that cannot be accessed from within type 'Application'.
app.use(responseTimeHeader);
        ~~~~~~~~~~~~~~~~~~

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

1 participant