Closed
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read 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-explicit-any
Description
Suggest to replace keyof any (and keyof never?) with PropertyKey as it is more explicit.
This can even be an auto fixable thing.
Fail
const integer = <TKey extends keyof any, TTarget extends { [K in TKey]: number }>(
target: TTarget,
key: TKey
) => { /* ... */ };
Pass
const integer = <TKey extends PropertyKey, TTarget extends { [K in TKey]: number }>(
target: TTarget,
key: TKey
) => { /* ... */ };
Additional Info
Extracted from #3206