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