This rule forbids the use of single-character type parameters.
Examples of incorrect code for this rule:
function toArray<T>(elements: ArrayLike<T>) {
return Array.from(elements);
}
type Entry<K, V> = {
key: K;
value: V;
};
Examples of correct code for this rule:
function toArray<Element>(elements: ArrayLike<Element>) {
return Array.from(elements);
}
type Entry<Key, Value> = {
key: Key;
value: Value;
};
This rule accepts a single option which is an object with a prefix
property that indicates the prefix - if any - that must be used for all type parameters. By default, there is no prefix.
{
"etc/no-t": [
"error",
{ "prefix": "T" }
]
}