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 - io-ts #274

Closed
MichaelHirn opened this issue Mar 10, 2022 · 6 comments
Closed

Failed to import - io-ts #274

MichaelHirn opened this issue Mar 10, 2022 · 6 comments
Labels
deno Not working in Deno types Types is wrong

Comments

@MichaelHirn
Copy link

MichaelHirn commented Mar 10, 2022

Failing module

import { something } from 'https://esm.sh/io-ts@v2.2.16?target=deno'

and

import { something } from 'https://esm.sh/io-ts@v2.2.16?target=deno&deps=fp-ts@2.11.8'

Error message

After running deno run I got this:

TS2344 [ERROR]: Type 'string' does not satisfy the constraint 'never'.
    at https://cdn.esm.sh/v68/fp-ts@2.2.0/lib/Either~.d.ts:305:155

Found 33 errors.

The important part is, that it tries to load fp-ts with version 2.2.0, even though io-ts species in peerDependencies that at least fp-ts@2.5.0 should be used. I have no idea where 2.2.0 is coming from (even when deps=fp-ts@2.11.8 is specified) and this is probably causing all the TS2344 errors.

Additional info

Also interesting to note is that, if I try to run with no-check flag:

export type { Branded } from 'https://esm.sh/io-ts@v2.2.16?target=deno&no-check'

the errors disappear but the exported types seem to disappear as well and I get this when running deno run:

error: TS2724 [ERROR]: '"https://esm.sh/io-ts@v2.2.16?target=deno&no-check"' has no exported member named 'Branded'. Did you mean 'brand'?
export type { Branded } from 'https://esm.sh/io-ts@v2.2.16?target=deno&no-check';
  • esm.sh version: 68
  • Deno version: 1.19.1

Potentially related issues: #168 #273

@MichaelHirn MichaelHirn added the deno Not working in Deno label Mar 10, 2022
@ije
Copy link
Member

ije commented Mar 11, 2022

when you pass the no-check option you can not use import type since there is no dts

@ije ije added the types Types is wrong label Mar 11, 2022
@MichaelHirn
Copy link
Author

Thanks for your reply, that makes sense with the no-check flag

@MichaelHirn
Copy link
Author

any ideas where the fp-ts@2.2.0 is coming from and if I can force it to load a different fp-ts version?

@ije
Copy link
Member

ije commented Mar 12, 2022

i will look into it, not sure what happened yet

@ije ije closed this as completed in 4d2989d Mar 20, 2022
@ije
Copy link
Member

ije commented Mar 20, 2022

fixed in v71, i also added the testing here: https://github.com/esm-dev/esm.sh/blob/master/test/deno/io-ts/io-ts.test.ts

@MichaelHirn
Copy link
Author

Many thanks @ije. This did fix the problem, however io-ts remains practically unusable for most, due to another error that pops up. I created a repo to reproduce and will open a separate issue

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