Skip to content

LGTM.com - false positive - Typescript (infer T extends U) pattern should be valid. #9621

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
Jym77 opened this issue Jun 20, 2022 · 2 comments

Comments

@Jym77
Copy link

Jym77 commented Jun 20, 2022

Description of the false positive
This alert is flagging a missing ? in a (infer T extends Value) TypeScript pattern, likely expecting the extends keyword to be part of a ternary extends Value ? … : … construction.
The infer T extends Value pattern is valid TypeScript that I was told to use as a workaround to a TS error, see this TS issue.

So, I guess this should be considered as valid syntax.

URL to the alert on the project page on LGTM.com
(tried to, but the alert is currently on a branch and I couldn't find how to tell LGTM.com to hook up on a branch rather than the latest released version 😕 )

@erik-krogh
Copy link
Contributor

Your example is only valid in TypeScript 4.7, and the code-scanning workflow was using TypeScript 4.6, which caused the error.

We already have support for TypeScript 4.7, but that was only released as of 2.9.4 (released 3 hours ago).
It will still take a while before 2.9.4 is used in your code-scanning workflows.

The alert should fix itself once you run an analysis using the new 2.9.4 version of CodeQL.

So thanks for the report, but it has already been fixed.

@Jym77
Copy link
Author

Jym77 commented Jun 21, 2022

Thanks for the answer.
Missed that point indeed 😖

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

No branches or pull requests

2 participants