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

Fix ts as expression type error #403

Merged
merged 2 commits into from
Aug 21, 2019
Merged

Conversation

G-Rath
Copy link
Collaborator

@G-Rath G-Rath commented Aug 21, 2019

I think our default stance on casts should be to just ignore them where possible, instead checking the node they're casting, for similar reason to why we don't bother w/ Boolean(<value>)

There could of course be code where it's logical to take casts into account, but I think this is a sensible default.

As such, I added expect(a.includes(b)).toEqual(0 as boolean); to reflect that.

fixes #332

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is beautiful 😀

Expression extends TSESTree.Expression = TSESTree.Expression
> extends TSESTree.TSTypeAssertion {
// expression: TypeAssertionChain<Expression> | Expression;
expression: any; // https://github.com/typescript-eslint/typescript-eslint/issues/802
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed in 2.0.0, so can be changed when we update.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Just needs us to drop node 6 then.

@SimenB SimenB merged commit 41d44d0 into master Aug 21, 2019
@SimenB SimenB deleted the fix-TSAsExpression-type-error branch August 21, 2019 20:15
@SimenB
Copy link
Member

SimenB commented Aug 21, 2019

🎉 This PR is included in version 22.15.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

prefer-to-be-null TypeError with TSAsExpression
2 participants