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 eslint-etc issue where hasTypeAnnotation function does not evaluate 'typeAnnotation' properly in call cases. #129

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bradkovach
Copy link

The recommended config crashes eslint due to an issue with undefined property detection/testing.

The intended behavior of hasOwnProperty only seems to work when a property is explicitly set as undefined. When values are implicitly set. This behavior is consistent with Object.hasOwn, object.hasOwnProperty and 'property' in object.

Here is a TS Playground demonstrating this behavior.

Only if(obj.typeAnnotation) and !!obj.typeAnnotation both consistently return false.

The easiest way to check for a typeAnnotation at this branch is to simply check for truthiness with if(param.typeAnnotation), which I have implemented in this PR.

Fixes #122

@zilia-gmethot
Copy link

What is preventing this pull request from being merged?

@Samuel-Therrien-Beslogic
Copy link

Samuel-Therrien-Beslogic commented Oct 8, 2024

@zilia-gmethot The maintainer, @cartant , hasn't been active on any of their public repos. Not to shame, life happens and this is volunteer work. But maybe worth looking into forking, adopting the project, or suggesting the rules to other maintained ESLint community projects.

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

Successfully merging this pull request may close these issues.

no-implicit-any-catch throws an error
3 participants