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

does not catch never type #78

Closed
dgreene1 opened this issue Sep 14, 2020 · 3 comments · Fixed by #113
Closed

does not catch never type #78

dgreene1 opened this issue Sep 14, 2020 · 3 comments · Fixed by #113

Comments

@dgreene1
Copy link

Expected Behavior:

I would expect the following to fail. It does not.

const result: never = () => { throw new Error() };

expectType<string>(result);
@BendingBender
Copy link
Collaborator

@dgreene1 @fregante @sindresorhus I've tried to reproduce this issue in the latest version of tsd without success. Can you please confirm that the latest version of tsd is not affected by this?

sindresorhus pushed a commit that referenced this issue Jun 3, 2021
… `expectType`/`expectNotType` (#113)

Closes #78
Closes #82
@JGJP
Copy link

JGJP commented Jan 17, 2024

@BendingBender
I can confirm that the latest version of tsd is affected by this. The original example needed some amending though:

const returnsNever = () => { throw new Error() }
const result: never = returnsNever()
expectType<string>(result)

@JGJP
Copy link

JGJP commented Jan 17, 2024

@BendingBender
This fails appropriately when using ts-expect:

expectType<TypeEqual<string, never>>(true)

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