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

Issue running v1.0.0 with std@0.50.0 #5319

Closed
jensen opened this issue May 14, 2020 · 8 comments
Closed

Issue running v1.0.0 with std@0.50.0 #5319

jensen opened this issue May 14, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@jensen
Copy link

jensen commented May 14, 2020

I tried Deno today. Congrats on 1.0.0, I wanted to report an issue I ran into at risk of embarrassing myself, it's possible that I just don't know what I'm doing.

I started today with v1.0.0-rc3 and used a few dependencies (fs, path, http) and denon as an installed cli tool. It worked fine.

When v1.0.0 was released I tried running my test application again and ran into a TS error.

error: TS2322 [ERROR]: Type 'string' is not assignable to type 'boolean'.
  return srcArray.reduce(
    at https://deno.land/std@v0.50.0/fs/_util.ts:20:3

I was able to resolve this one of two ways for my project.

  1. I could downgrade to v1.0.0-rc3
  2. I could use the latest version of std

With some investigating it seems like maybe this changed caused a desync between the runtime and std. 3d7552a#diff-da37be1ae0975896a3e9d32a5131aeae

In order to get denon working my only option is to downgrade deno to v1.0.0-rc3.

Figure this is fixed with the next release of std, as soon as denon upgrades.

@BevanR
Copy link

BevanR commented May 14, 2020

This is probably a bug in denon; denosaurs/denon#34

@jensen
Copy link
Author

jensen commented May 14, 2020

I get the same error in my own small test app when I import std@0.50.0/fs using v1.0.0, and not when using v.1.0.0-rc3.

deps.ts

export { serve } from "https://deno.land/std@0.50.0/http/server.ts";
export { resolve, join } from "https://deno.land/std@0.50.0/path/mod.ts";
export { readFileStr } from "https://deno.land/std@0.50.0/fs/mod.ts";

main.ts

import {
  readFileStr,
  join,
  resolve,
  serve,
} from "./deps.ts";

const server = serve({ port: 3001 });
const publicFolder = resolve("public");

for await (const req of server) {
  if (req.url === "/") {
    const fileContents = await readFileStr(
      join(publicFolder, "index.html"),
      { encoding: "utf8" },
    );
    req.respond({ body: fileContents });
  } else {
    req.respond({
      status: 404,
      body: "Not Found\n",
    });
  }
}

@eliassjogreen
Copy link
Contributor

eliassjogreen commented May 14, 2020

Typescript issue #30821 is commented in the std source so this is probably not an issue with deno nor denon

@alextes
Copy link

alextes commented May 14, 2020

Could it be the @ts-ignore is on the wrong line?

The issue linked in the https://deno.land/std@v0.50.0/fs/_util.ts source talks about inference showing a false positive (I think). Putting a @ts-ignore and a comment explaining why is the A+ way to deal with it in my book. Yet, an error shows up and blocks the install of Denon and I'm guessing any other package importing this module. Error shows up on line 20, ts-ignore is on line 21.

@ry ry added the bug Something isn't working label May 14, 2020
@alextes
Copy link

alextes commented May 14, 2020

Went to fix it but noticed it's already fixed in master (3d7552a) 🎉 .

You people move fast! Thanks @kitsonk 🙏 .

@bartlomieju
Copy link
Member

@alextes std 0.51.0 has been released.

@C0Nd3Mnd
Copy link

Doesn't work for me with 0.51.0 either:

deno run --allow-net --allow-read index.ts

...results in:

TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:90:16

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
    Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:101:10

TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
  await Deno.symlink(originSrcFilePath, dest, type);
             ~~~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:114:14

TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
    await Deno.utime(dest, statInfo.atime, statInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:119:16

TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
  Deno.symlinkSync(originSrcFilePath, dest, type);
       ~~~~~~~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:132:8

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
    Deno.utimeSync(dest, statInfo.atime, statInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:137:10

TS2339 [ERROR]: Property 'utime' does not exist on type 'typeof Deno'.
    await Deno.utime(dest, srcStatInfo.atime, srcStatInfo.mtime);
               ~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:157:16

TS2339 [ERROR]: Property 'utimeSync' does not exist on type 'typeof Deno'.
    Deno.utimeSync(dest, srcStatInfo.atime, srcStatInfo.mtime);
         ~~~~~~~~~
    at https://deno.land/std@0.51.0/fs/copy.ts:185:10

TS2339 [ERROR]: Property 'link' does not exist on type 'typeof Deno'.
  await Deno.link(src, dest);
             ~~~~
    at https://deno.land/std@0.51.0/fs/ensure_link.ts:28:14

TS2339 [ERROR]: Property 'linkSync' does not exist on type 'typeof Deno'.
  Deno.linkSync(src, dest);
       ~~~~~~~~
    at https://deno.land/std@0.51.0/fs/ensure_link.ts:52:8

TS2339 [ERROR]: Property 'symlink' does not exist on type 'typeof Deno'.
  await Deno.symlink(src, dest, srcFilePathType);
             ~~~~~~~
    at https://deno.land/std@0.51.0/fs/ensure_symlink.ts:31:14

TS2339 [ERROR]: Property 'symlinkSync' does not exist on type 'typeof Deno'.
  Deno.symlinkSync(src, dest, srcFilePathType);
       ~~~~~~~~~~~
    at https://deno.land/std@0.51.0/fs/ensure_symlink.ts:58:8

Found 12 errors.

Version (on Windows 10):

> deno --version
deno 1.0.0
v8 8.4.300
typescript 3.9.2

@bartlomieju
Copy link
Member

@C0Nd3Mnd use --unstable flag; more info here: https://deno.land/manual/standard_library#troubleshooting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants