Skip to content

Error ts(1345) when using JavaScript logical operator as statement #31604

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

Closed
JipingWang opened this issue May 26, 2019 · 1 comment
Closed

Error ts(1345) when using JavaScript logical operator as statement #31604

JipingWang opened this issue May 26, 2019 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@JipingWang
Copy link

TypeScript Version: 3.4.5

Search Terms: operator

Code

<form className={classes.form} onSubmit={e => e.preventDefault() || false}>

Expected behavior:
valid, no error throws.

Actual behavior:
Error ts(1345): An expression of type 'void' cannot be tested for truthiness.

@j-oliveras
Copy link
Contributor

This is working as intended: #26262, PR #26234. Duplicate of #28248.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants