Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Issue Description
When using the new (as of TS 4.7).mts file extension theconst foo = <T>() => ... syntax for generic arguments is reserved similar to JSX files. The suggestion from tsc recommends defining an explicit constraint:
Since my function doesn't need or nor do I want a type constraint, but I need one for the syntax, I reached for the noop constraint ofextends any, but then I was violating theno-unnecessary-type-constraint rule.
In this case, with the.mts extension and it's limited syntax I think it's unfair to say it "doesn't do anything and is unnecessary".
Reproduction Repository Link
https://github.com/spalger/reproduce-issues/tree/ts-eslint-no-unnecessary-type-constraint
Repro Steps
clone the repo with
--branchgit clone git@github.com:spalger/reproduce-issues.git --branch ts-eslint-no-unnecessary-type-constraintnpm inpm run lint
Versions
| package | version |
|---|---|
@typescript-eslint/eslint-plugin | 5.33.0 |
@typescript-eslint/parser | 5.33.0 |
TypeScript | 4.7.4 |
ESLint | 8.21.0 |
node | 18.7.0 |

