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

Deno on Win 10 TS Error #85

Closed
ekaone opened this issue May 16, 2020 · 1 comment
Closed

Deno on Win 10 TS Error #85

ekaone opened this issue May 16, 2020 · 1 comment
Labels
question A general question versus an issue or defect

Comments

@ekaone
Copy link

ekaone commented May 16, 2020

Hi Everyone,

I am try Oak middleware as as example below:

import { Application } from "https://deno.land/x/oak/mod.ts";
const app = new Application();
app.use((ctx) => {
  ctx.response.body = "Hello world!";
});
await app.listen("127.0.0.1:8000");

I already install typescript as global npm install -g typescript, and run Deno on terminal with deno --allow-net .\oak.ts, my operating system Win 10 is latest version update, and i also try running as Administrator or another user on terminal and with same Error output, anyone can point some best a away..?, thanks in advance

Error appear as below:

Compile file:///D:/deno-sample/oak.ts
error TS2322: Type '(_: Uint8Array) => Promise<number | null>' is not assignable to type '(p: Uint8Array) => Promise<number | unique symbol>'.
  Type 'Promise<number | null>' is not assignable to type 'Promise<number | unique symbol>'.

► https://deno.land/std@0.51.0/http/_io.ts:10:5

10     read(_: Uint8Array): Promise<number | null> {
       ~~~~
error TS2322: Type '(buf: Uint8Array) => Promise<number | null>' is not assignable to type '(p: Uint8Array) => Promise<number | unique symbol>'.  Type 'Promise<number | null>' is not assignable to type 'Promise<number | unique symbol>'.

► https://deno.land/std@0.51.0/http/_io.ts:35:12

35   return { read };
              ~~~~
error TS2322: Type '(buf: Uint8Array) => Promise<number | null>' is not assignable to type '(p: Uint8Array) => Promise<number | unique symbol>'.  Type 'Promise<number | null>' is not assignable to type 'Promise<number | unique symbol>'.
► https://deno.land/std@0.51.0/http/_io.ts:113:12
113   return { read };
               ~~~~
error TS2339: Property 'iter' does not exist on type 'typeof Deno'.

► https://deno.land/std@0.51.0/http/_io.ts:167:34

167   for await (const chunk of Deno.iter(r)) {
                                     ~~~~

error TS2345: Argument of type 'Reader' is not assignable to parameter of type 'Writer'.
  Property 'write' is missing in type 'Reader' but required in type 'Writer'.
► https://deno.land/std@0.51.0/http/_io.ts:265:31
265     const n = await Deno.copy(r.body, writer);
                                  ~~~~~~
  'write' is declared here.

    ► $asset$/lib.deno.ns.d.ts:463:5

    463     write(p: Uint8Array): Promise<number>;
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error TS2339: Property 'listenTls' does not exist on type 'typeof Deno'.

► https://deno.land/std@0.51.0/http/server.ts:16:17
16 const { listen, listenTls } = Deno;
                   ~~~~~~~~~
error TS2694: Namespace 'Deno' has no exported member 'ListenTlsOptions'.
► https://deno.land/std@0.51.0/http/server.ts:289:38
289 export type HTTPSOptions = Omit<Deno.ListenTlsOptions, "transport">;
                                         ~~~~~~~~~~~~~~~~
error TS2694: Namespace 'Deno' has no exported member 'ListenTlsOptions'.
► https://deno.land/std@0.51.0/http/server.ts:309:26

309   const tlsOptions: Deno.ListenTlsOptions = {
                             ~~~~~~~~~~~~~~~~
error TS2694: Namespace 'Deno' has no exported member 'WriterSync'.
► https://deno.land/std@0.51.0/io/bufio.ts:8:24
8 type WriterSync = Deno.WriterSync;
                         ~~~~~~~~~~
error TS2469: The '>=' operator cannot be applied to type 'symbol'.

► https://deno.land/std@0.51.0/io/bufio.ts:90:14

90       assert(rr >= 0, "negative read");
                ~~
error TS2365: Operator '+=' cannot be applied to types 'number' and 'number | unique symbol'.
► https://deno.land/std@0.51.0/io/bufio.ts:91:7

91       this.w += rr;
         ~~~~~~~~~~~~
error TS2469: The '>' operator cannot be applied to type 'symbol'.
► https://deno.land/std@0.51.0/io/bufio.ts:92:11

92      if (rr > 0) {
             ~~
error TS2416: Property 'read' in type 'BufReader' is not assignable to the same property in base type 'Reader'.
  Type '(p: Uint8Array) => Promise<number | null>' is not assignable to type '(p: Uint8Array) => Promise<number | unique symbol>'.
    Type 'Promise<number | null>' is not assignable to type 'Promise<number | unique symbol>'.
      Type 'number | null' is not assignable to type 'number | unique symbol'.
        Type 'null' is not assignable to type 'number | unique symbol'.
► https://deno.land/std@0.51.0/io/bufio.ts:123:9

123   async read(p: Uint8Array): Promise<number | null> {
            ~~~~
error TS2469: The '>=' operator cannot be applied to type 'symbol'.
► https://deno.land/std@0.51.0/io/bufio.ts:133:16
133         assert(nread >= 0, "negative read");
                   ~~~~~
error TS2322: Type 'number | unique symbol' is not assignable to type 'number | null'.
  Type 'unique symbol' is not assignable to type 'number | null'.
► https://deno.land/std@0.51.0/io/bufio.ts:138:9
138         return rr;
            ~~~~~~~~~~
error TS2322: Type 'number | unique symbol' is not assignable to type 'number | null'.
  Type 'unique symbol' is not assignable to type 'number | null'.
► https://deno.land/std@0.51.0/io/bufio.ts:145:7
145       rr = await this.rd.read(this.buf);
          ~~
error TS2367: This condition will always return 'false' since the types 'OperatingSystem' and '"windows"' have no overlap.
► https://deno.land/std@0.51.0/path/_constants.ts:51:19

51 const isWindows = build.os == "windows";
                     ~~~~~~~~~~~~~~~~~~~~~
error TS2367: This condition will always return 'false' since the types 'OperatingSystem' and '"windows"' have no overlap.
► https://deno.land/std@0.51.0/path/_globrex.ts:5:15
5 const isWin = Deno.build.os === "windows";
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error TS2367: This condition will always return 'false' since the types 'OperatingSystem' and '"windows"' have no overlap.
► https://deno.land/std@0.51.0/path/mod.ts:7:19
7 const isWindows = Deno.build.os == "windows";
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~
error TS2345: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
► https://deno.land/std@0.51.0/path/posix.ts:433:18

433   return new URL(url).pathname;
                     ~~~
error TS2367: This condition will always return 'false' since the types 'OperatingSystem' and '"windows"' have no overlap.
► https://deno.land/std@0.51.0/path/separator.ts:2:19

2 const isWindows = Deno.build.os == "windows";
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~
error TS2339: Property 'get' does not exist on type '{ (): { [index: string]: string; }; (key: string): string | undefined; }'.
► https://deno.land/std@0.51.0/path/win32.ts:42:18

42       path = env.get(`=${resolvedDevice}`) || cwd();
                    ~~~
error TS2345: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
► https://deno.land/std@0.51.0/path/win32.ts:911:18

911   return new URL(url).pathname
                     ~~~
error TS2304: Cannot find name 'AbortSignal'.
► https://deno.land/x/oak/application.ts:18:12

18   signal?: AbortSignal;
              ~~~~~~~~~~~
error TS2304: Cannot find name 'AbortSignal'.
► https://deno.land/x/oak/application.ts:27:12
27   signal?: AbortSignal;
              ~~~~~~~~~~~
error TS2304: Cannot find name 'ErrorEventInit'.

► https://deno.land/x/oak/application.ts:45:11

45   extends ErrorEventInit {
             ~~~~~~~~~~~~~~
error TS2304: Cannot find name 'ErrorEvent'.

► https://deno.land/x/oak/application.ts:78:61
78 export class ApplicationErrorEvent<S extends State> extends ErrorEvent {
                                                               ~~~~~~~~~~
error TS2345: Argument of type '{ context: Context<S>; message: any; error: any; }' is not assignable to parameter of type 'ApplicationErrorEventInit<S>'.
  Object literal may only specify known properties, and 'message' does not exist in type 'ApplicationErrorEventInit<S>'.

► https://deno.land/x/oak/application.ts:153:53

153       new ApplicationErrorEvent("error", { context, message, error }),
                                                        ~~~~~~~

error TS2416: Property 'addEventListener' in type 'Application<S>' is not assignable to the same property in base type 'EventTarget'.
  Type '(type: "error", listener: ApplicationErrorEventListener<S> | ApplicationErrorEventListenerObject<S> | null, options?: any) => void' is not assignable to type '(type: string, callback: EventListener | EventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void'.
    Types of parameters 'listener' and 'callback' are incompatible.
      Type 'EventListener | EventListenerObject | null' is not assignable to type 'ApplicationErrorEventListener<S> | ApplicationErrorEventListenerObject<S> | null'.
        Type 'EventListener' is not assignable to type 'ApplicationErrorEventListener<S> | ApplicationErrorEventListenerObject<S> | null'.      
          Type 'EventListener' is not assignable to type 'ApplicationErrorEventListener<S>'.
            Types of parameters 'evt' and 'evt' are incompatible.
              Type 'ApplicationErrorEvent<S>' is missing the following properties from type 'Event': type, target, currentTarget, composedPath, 
and 17 more.
► https://deno.land/x/oak/application.ts:202:3

202   addEventListener(
      ~~~~~~~~~~~~~~~~
error TS2304: Cannot find name 'AddEventListenerOptions'.

► https://deno.land/x/oak/application.ts:205:25

205     options?: boolean | AddEventListenerOptions,
                            ~~~~~~~~~~~~~~~~~~~~~~~
error TS2416: Property 'addEventListener' in type 'Application<S>' is not assignable to the same property in base type 'EventTarget'.
  Type '(type: "error", listener: ApplicationErrorEventListener<S> | ApplicationErrorEventListenerObject<S> | null, options?: any) => void' is not assignable to type '(type: string, callback: EventListener | EventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) => void'.

► https://deno.land/x/oak/application.ts:207:3
207   addEventListener(
      ~~~~~~~~~~~~~~~~
error TS2304: Cannot find name 'EventListenerOrEventListenerObject'.
► https://deno.land/x/oak/application.ts:209:15

209     listener: EventListenerOrEventListenerObject | null,
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error TS2304: Cannot find name 'AddEventListenerOptions'.

► https://deno.land/x/oak/application.ts:210:25

210     options?: boolean | AddEventListenerOptions,
                            ~~~~~~~~~~~~~~~~~~~~~~~

error TS2345: Argument of type '{ message: string; error: any; }' is not assignable to parameter of type 'ApplicationErrorEventInit<Record<string | number | symbol, any>>'.
  Object literal may only specify known properties, and 'message' does not exist in type 'ApplicationErrorEventInit<Record<string | number | symbol, any>>'.

► https://deno.land/x/oak/application.ts:254:46

254         new ApplicationErrorEvent("error", { message, error }),
                                                 ~~~~~~~
error TS2322: Type '() => boolean' is not assignable to type 'boolean'.
► https://deno.land/x/oak/send.ts:62:12
62     return (await Deno.stat(path)).isFile;
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Did you mean to call this expression?
    ► https://deno.land/x/oak/send.ts:62:12
    62     return (await Deno.stat(path)).isFile;
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error TS2774: This condition will always return true since the function is always defined. Did you mean to call it instead?

► https://deno.land/x/oak/send.ts:135:9

135     if (stats.isDirectory) {
            ~~~~~~~~~~~~~~~~~

error TS2339: Property 'mtime' does not exist on type 'FileInfo'.

► https://deno.land/x/oak/send.ts:151:55

151   if (!response.headers.has("Last-Modified") && stats.mtime) {
                                                          ~~~~~
error TS2339: Property 'mtime' does not exist on type 'FileInfo'.

► https://deno.land/x/oak/send.ts:152:49

152     response.headers.set("Last-Modified", stats.mtime.toUTCString());
                                                    ~~~~~
Found 38 errors.
@gjuoun
Copy link

gjuoun commented May 16, 2020

  1. Make sure you have the newest Deno runtime (v1.0.0)
  2. Open PowerShell, type deno run --allow-net --reload <your_app>.ts

@kitsonk kitsonk added the question A general question versus an issue or defect label May 16, 2020
@kitsonk kitsonk closed this as completed May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A general question versus an issue or defect
Projects
None yet
Development

No branches or pull requests

3 participants