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

Failed to import memfs with typechecking #363

Closed
espindola opened this issue Jul 8, 2022 · 2 comments
Closed

Failed to import memfs with typechecking #363

espindola opened this issue Jul 8, 2022 · 2 comments
Labels
deno Not working in Deno types Types is wrong

Comments

@espindola
Copy link

Trying to import

import 'https://esm.sh/[email protected]?target=deno'

with

deno run --check=all --reload  test.ts

fails with

error: TS2300 [ERROR]: Duplicate identifier 'URLSearchParams'.
declare class URLSearchParams {
              ~~~~~~~~~~~~~~~
    at asset:///lib.deno.url.d.ts:8:15

    'URLSearchParams' was also declared here.
            interface URLSearchParams extends _URLSearchParams {}
                      ~~~~~~~~~~~~~~~
        at https://esm.sh/v86/@types/[email protected]/url.d.ts:822:19    and here.
....

This is surprisingly hard to reduce. I downloaded the code with

$ curl -o foo.js -Dheader 'https://esm.sh/[email protected]?target=deno'

and changed the test to

// @deno-types="https://esm.sh/v86/[email protected]/lib/index.d.ts"
import './foo.js'

But this changes the error to

error: Relative import path "querystring" not prefixed with / or ./ or ../
    at https://esm.sh/v86/@types/[email protected]/querystring.d.ts:131:19

The last one at least is easy to see, line 131 has:

 export * from 'querystring';
@ije
Copy link
Member

ije commented Jul 8, 2022

seems the types is incorrect, you can disable it by ?no-check

@ije ije added the types Types is wrong label Jul 8, 2022
@espindola espindola changed the title Failed to import memfs Failed to import memfs with typechecking Jul 9, 2022
@espindola
Copy link
Author

seems the types is incorrect, you can disable it by ?no-check

Yes, or just not passing --check to deno. I have updated the description to say that the issue is with the .d.ts files, the .js is fine.

@ije ije closed this as completed in 4ca3399 Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno Not working in Deno types Types is wrong
Projects
None yet
Development

No branches or pull requests

2 participants