A type is written as String, Number or another wrapper object instead of the primitive

tx0/ts:wrapper-type-annotationrecommendedwarningsmell

What it finds

name: String, count: Number: the capitalized names are the types of the wrapper objects that new String(...) creates, not of the primitive values. They accept primitives too, but a value of type String cannot be passed where string is expected, and the type admits wrapper objects that behave differently in conditions and comparisons.

String, Number, Boolean, Symbol and BigInt are reported where they are not a type the file declares. The fix lowercases the name and is safe.

From the rule's source, wrapper_type_annotation.rs.

Example from the rule's tests
function show(  name: String,tx0 reports: String is the type of wrapper objects  count: Number,tx0 reports: Number is the type of wrapper objects): boolean {  return name.length > 0 && count > 0;}
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 recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

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

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