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 Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Link to the rule's documentation
https://typescript-eslint.io/rules/no-unnecessary-type-parameters/
Description
For purposes of counting whether a generic type parameter is used twice,T[]
/Array<T>
should only count as using it once. I'm not aware of any realistic scenario where this would lead to a false positive.
We decided to defer this to a follow-up in the initial implementation (see links below). So here's an official request for the follow-up.
Fail
declarefunctiongetLength<T>(xs:readonlyT[]):number;
Pass
declarefunctiongetLength(xs:readonlyunknown[]):number;
Additional Info
Seehttps://twitter.com/jfet97/status/1810703565280759964 and#8173 (comment) for context on why this doesn't work as expected today.
See#8173 (comment) for previous discussion of special-casingArray
and friends.
See#8173 (review) for acontrived example of how this could yield a false positive forMap
.