A type alias only renames another named type or a primitive

tx0/ts:alias-of-single-typestrictwarningmaintainability/designdepth fastsmell

What it finds

type UserId = string gives a second name to string that TypeScript treats as fully interchangeable with it, so the name suggests a distinction the compiler does not make. Using the type directly, or a branded type, is clearer.

Reported are type aliases without type parameters whose type is a primitive keyword or a single type name without type arguments.

From the rule's source, alias_of_single_type.rs.

Example from the rule's tests
export type UserId = string;tx0 reports: this alias only renames stringexport type Pair = [string, string];
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:alias-of-single-type" = "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:alias-of-single-type] reason="..."

tx0 explain tx0/ts:alias-of-single-type shows the same in the terminal. Found a false positive? Report it.