deno: Argument of type 'string | URL' is not assignable to parameter of type 'string'

Just upgrade my deno to 1.2 and then my production software failure, i really need some help in hurry , anybody can help?

error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@v0.55.0/path/win32.ts:917:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@v0.55.0/path/posix.ts:438:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.51.0/path/win32.ts:911:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.51.0/path/posix.ts:433:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.55.0/path/win32.ts:917:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.55.0/path/posix.ts:438:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@0.59.0/path/win32.ts:917:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@0.59.0/path/posix.ts:438:18

Found 8 errors.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 37 (14 by maintainers)

Most upvoted comments

@chovy It looks like there’s an unversioned dependency on the std/log module, which is causing that error. You can try reloading the cache by running deno cache --reload deps.ts, and try again, that should hopefully fix the error.

Caused by #6653. Version of std prior to 0.61.0 are incompatible with Deno 1.2.0. deno info main.ts will give you the dependency graph and you can determine what dependencies need to be updated to they are using std 0.61.0.

I’m so lost. how the f— do I fix this error? There’s no package manager.

I am getting this error too. But, it seems to be deep within deno

Check file:///Users/reselbob/Documents/source-tree/denodemo/pubbersubber/tests/.deno.test.ts
error: TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname
                 ~~~
    at https://deno.land/std@v0.57.0/path/win32.ts:917:18

TS2345 [ERROR]: Argument of type 'string | URL' is not assignable to parameter of type 'string'.
  Type 'URL' is not assignable to type 'string'.
  return new URL(url).pathname;
                 ~~~
    at https://deno.land/std@v0.57.0/path/posix.ts:438:18
$ deno --version
deno 1.2.0
v8 8.5.216
typescript 3.9.2

But, hey, I could be missing the boat entirely.

PS: Here is my code: https://github.com/reselbob/denodemo

Here is how to replicate:

git clone https://github.com/reselbob/denodemo.git
cd denodemo/pubbersubber/tests/
sh run_tests.sh

Thanks in advance. I really am at wit’s end. If the trouble is my own doing, please forgive me.

I had this problem after updating in a script which uses only Deno dependencies. I had to refresh the cache by running the deno cache command above. I figured it was a catching issue but wasn’t sure how to resolve it. Thanks @fauzan121002