christophgysin / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

s3 (more?) broken with Deno v1.11.0, ok with v1.10.3

grempe opened this issue · comments

Describe the bug

Deno throws numerous errors when running deno cache against a simple demo script when using latest version of Deno 1.11.0, but previous version 1.10.3 works fine. My demo code that reproduces the error is S3 specific, but I suspect this is a much broader issue.

Your environment

macOS Big Sur (Intel)

SDK version number

aws_sdk@v3.17.0-2

Details of the deno version

Two Deno binaries:

manual install:

❯ /Users/glenn/.deno/bin/deno -V
deno 1.10.3

homebrew install:

❯ deno -V
deno 1.11.0

Steps to reproduce

Sample code s3bug.ts:

import { S3 } from "https://deno.land/x/aws_sdk@v3.17.0-2/client-s3/mod.ts";
const _s3 = new S3({});

Run deno cache --unstable s3bug.ts with each version of Deno.

Observed behavior

Version 1.11.0 throws:

❯ deno cache --unstable s3bug.ts 
Check file:///Users/glenn/src/github.com/truestamp/truestamp-cli/s3bug.ts
error: TS2345 [ERROR]: Argument of type 'FsWatcher' is not assignable to parameter of type 'AsyncIterableIterator<FsEvent>'.
  Property 'next' is missing in type 'FsWatcher' but required in type 'AsyncIterableIterator<FsEvent>'.
  asyncIterableIteratorToCallback<Deno.FsEvent>(iterator, (val, done) => {
                                                ~~~~~~~~
    at https://deno.land/std@0.97.0/node/_fs/_fs_watch.ts:91:49

    'next' is declared here.
        next(...args: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        at asset:///lib.es2018.asynciterable.d.ts:34:5

TS7022 [ERROR]: 'arch[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
arch[Symbol.toPrimitive] = (): string => arch();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:92:1

TS7022 [ERROR]: 'endianness[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
endianness[Symbol.toPrimitive] = (): string => endianness();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:93:1

TS7022 [ERROR]: 'freemem[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
freemem[Symbol.toPrimitive] = (): number => freemem();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:94:1

TS7022 [ERROR]: 'homedir[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
homedir[Symbol.toPrimitive] = (): string | null => homedir();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:95:1

TS7022 [ERROR]: 'hostname[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
hostname[Symbol.toPrimitive] = (): string | null => hostname();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:96:1

TS7022 [ERROR]: 'platform[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
platform[Symbol.toPrimitive] = (): string => platform();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:97:1

TS7022 [ERROR]: 'release[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
release[Symbol.toPrimitive] = (): string => release();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:98:1

TS7022 [ERROR]: 'totalmem[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
totalmem[Symbol.toPrimitive] = (): number => totalmem();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:99:1

TS7022 [ERROR]: 'type[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
type[Symbol.toPrimitive] = (): string => type();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:100:1

TS7022 [ERROR]: 'uptime[Symbol.toPrimitive]' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.
uptime[Symbol.toPrimitive] = (): number => uptime();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.97.0/node/os.ts:101:1

Found 11 errors.

Version 1.10.3 throws no errors and exits cleanly.

Expected behavior

No Typescript errors should be thrown.

Additional context

Deno version 1.11.0 has numerous changes, including an upgrade to a new version of Typescript.

https://github.com/denoland/deno/releases/tag/v1.11.0

Any update to this? Or is there a workaround I could use?

I updated deno std to 0.101.0 in 3.17.0-3. Could you try again with that?

Thanks for the update! There is improvement, with one issue seemingly remaining for my tiny test case file (shown above).

I updated the test case file to use the newest release version as of today:

import { S3 } from "https://deno.land/x/aws_sdk@v3.22.0-1/client-s3/mod.ts";
const _s3 = new S3({});

Running this with deno 1.10.3 (a little older now) fails with:

❯ curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh -s v1.10.3
######################################################################## 100.0%
Archive:  /usr/local/bin/deno.zip
  inflating: /usr/local/bin/deno     
Deno was installed successfully to /usr/local/bin/deno
Run 'deno --help' to get started
❯ deno --version                                                                           
deno 1.10.3 (release, x86_64-apple-darwin)
v8 9.1.269.27
typescript 4.2.2
truestamp-cli on  main [?] via  v16.5.0 on ☁️  (us-east-1) on ☁️  glenn@truestamp.com 
❯ deno run -A --unstable s3bug.ts                                                          
Check file:///Users/glenn/src/github.com/truestamp/truestamp-cli/s3bug.ts
error: TS18022 [ERROR]: A method cannot be named with a private identifier.
  #tryGrowByReslice(n: number) {
  ~~~~~~~~~~~~~~~~~
    at https://deno.land/std@0.101.0/io/buffer.ts:85:3

TS18022 [ERROR]: A method cannot be named with a private identifier.
  #reslice(len: number) {
  ~~~~~~~~
    at https://deno.land/std@0.101.0/io/buffer.ts:94:3

TS18022 [ERROR]: A method cannot be named with a private identifier.
  #grow(n: number) {
  ~~~~~
    at https://deno.land/std@0.101.0/io/buffer.ts:141:3

Found 3 errors.

The good news is that running the same code with Deno v1.12.1 and v1.11.0 runs cleanly! So for the most recent few versions of Deno the issue might be resolved (according to my minimal test case).

Great, thanks for testing. The errors you experience with deno 1.10.3 are due to the std lib not being backwards compatible.