-1

So I started to learn Deno. Once Deno installed (I'm using Curl curl -fsSL https://deno.land/x/install/install.sh | sh for my WSL), I want to run the server. Once run deno run index.ts, I got these typescript error.

$ deno run index.ts 
Compile file:///C:/Users/User/Works/tw_revamp_deno_server/index.ts
error TS2304: Cannot find name 'TransformStream'.
  const res = new TransformStream<Promise<R>, R>({
                  ~~~~~~~~~~~~~~~
    at https://deno.land/std@0.69.0/async/pool.ts:18:19

error TS2304: Cannot find name 'TransformStreamDefaultController'.
      controller: TransformStreamDefaultController<R>,
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.69.0/async/pool.ts:21:19

error TS2322: Type 'Uint8Array | undefined' is not assignable to type 'Uint8Array | null'.
  Type 'undefined' is not assignable to type 'Uint8Array | null'.
    return line;
    ~~~~~~~~~~~~
    at https://deno.land/std@0.69.0/textproto/mod.ts:149:5

Found 3 errors.

My index.ts file is plain and similar with the example given.

import { serve } from "https://deno.land/std@0.69.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
  req.respond({ body: "Hello World\n" });
}

Anyone have got similar error and know how to fix. Feel free to reply. Thanks

Arif Mustaffa
  • 143
  • 1
  • 2
  • 7

1 Answers1

1

I think you can try to disable type checking with --no-check flag, using this option also helps to startup faster.

$ deno run --no-check index.ts
tmhao2005
  • 14,776
  • 2
  • 37
  • 44