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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Issue Description
When using the new (as of TS 4.7) .mts
file extension the const 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 of extends any
, but then I was violating the no-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
--branch
git clone git@github.com:spalger/reproduce-issues.git --branch ts-eslint-no-unnecessary-type-constraint
-
npm i
-
npm 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 |