question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
towelongcommented, Jul 21, 2020

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.```
2reactions
Frenzoidcommented, Jul 16, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

dart - How can I resolve "The argument type 'String' can't be ...
You have to set data variable to List type. That's should work: import 'dart:convert'; import 'package:flutter/material.dart ...
Read more >
Argument type 'String' can't be Assigned to type "Uri" #81200
I tried to make a world time app, but I got an error: Argument type 'String' can't be Assigned to type "Uri". Is...
Read more >
Flutter – Error : the argument type int cannot be assigned to ...
error : The argument type '(int) → dynamic' can't be assigned to the parameter type '(String) → void' import 'package:flutter/material.dart'; ...
Read more >
TypeScript errors and how to fix them
error TS1202 : Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from “mod”', 'import {a} from...
Read more >
SyntaxError: unterminated string literal - JavaScript | MDN
The JavaScript error "unterminated string literal" occurs when there is an unterminated string literal somewhere. String literals must be enclosed by single ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found