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

ts2367 not implemented, unintentional comparison #222

Open
Uzlopak opened this issue Oct 24, 2024 · 1 comment
Open

ts2367 not implemented, unintentional comparison #222

Uzlopak opened this issue Oct 24, 2024 · 1 comment

Comments

@Uzlopak
Copy link

Uzlopak commented Oct 24, 2024

Currently implementing something for fastify, which can be simplified to:

const b: 'GET' | 'POST' = 'GET'

expectError(b === 1)
  534:4   Found an error that tsd does not currently support (ts2367), consider creating an issue on GitHub.                                                   
    534:16  This comparison appears to be unintentional because the types string | (string & Record<never, never>) | HTTPMethods[] and number have no overlap.

And yes I could do

expectAssignable<string>(b)

but it is less expressive imho

@mrazauskas
Copy link
Contributor

Perhaps: expectType<'GET'>(b)?

But just like expectError(b === 1) these lines only proof that TypeScript works as expected. I understand the example you provided is simplified. It made me curious: what are you trying to test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants