A union or intersection type lists the same type twice
What it finds
string | number | string, Base & Named & Base: a union or intersection that lists the same type twice means the same with it once. The repetition is usually a copy that was meant to be changed into another type.
Types are compared by their tokens, so Array<T> and T[] count as different.
From the rule's source, repeated_type_member.rs.
type Id = string | number | string;tx0 reports: string is already in this uniontype Named = { name: string };type Both = Named & { id: number } & Named;tx0 reports: Named is already in this intersectiontype Fine = string | number; Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:repeated-type-member" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:repeated-type-member] reason="..."tx0 explain tx0/ts:repeated-type-member shows the same in the terminal. Found a false positive? Report it.