denodb: Error when importing -> string | URL cannot be assigned to string

Just importing on a clean project get this error

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

on deno 1.2.0 ran on debian 10 with denon

About this issue

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

Most upvoted comments

I try to use deno’s 1.1.3 version,but it has error also,and I switched back to version 1.2.0

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/x/dex/lib/deps/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/x/dex/lib/deps/path/posix.ts:433:18

Found 2 errors.```

Hello avalero!

I’ve checked this error since im getting it with other imports as well, aside from denodb, and seems to be happening because the current version of deno (1.2.0) doesn’t work properly with some old std / library versions (in my case posix and dex libraries) that the current importing library is importing.

So, until denodb’s imports are updated and tested, i’d suggest you to stick with previous deno version for now.

(Also, duplicate from https://github.com/eveningkid/denodb/issues/77)

Best regards!

Hey guys,

I just released 1.0.6 which is also available on deno.land now: http://deno.land/x/denodb@v1.0.6.

On a clean project, it works fine for me so that should do it.

Let me know if it doesn’t (but let’s be hopeful!).

Have a great week 😃

I have the same error when I import my database configuration in my entry file. What is the solution? I use Deno 1.2.3

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/x/dex@1.0.2/lib/deps/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/x/dex@1.0.2/lib/deps/path/posix.ts:433:18

Found 2 errors.

Hey guys,

I just released 1.0.6 which is also available on deno.land now: http://deno.land/x/denodb@v1.0.6.

On a clean project, it works fine for me so that should do it.

Let me know if it doesn’t (but let’s be hopeful!).

Have a great week 😃

Hello @Frenzoid , FYI, in case of the deno mongo driver, with deno 1.2.0 you need to use deno-mongo 0.9.1 version. Previous version is no longer supported. I hope this can help. BR