no-unnecessary-type-conversion
Configuration
Rule Details
Disallow conversion idioms when they do not change the type or value of the expression. TypeScript already tracks the type of every expression, so calling String(x), Number(x), Boolean(x), BigInt(x), .toString(), +x, !!x, ~~x, or concatenating with '' when the source expression already has the target type is a no-op — it adds noise without changing the value or the type.
The rule never reports on new String(...), new Number(...), new Boolean(...), or new BigInt(...); those construct wrapper objects whose runtime type is object, not the primitive, so the call is not a no-op. It also opts out of the .toString() check when the receiver is an enum or enum member, since .toString() there is the documented way to read the enum's underlying string or number. A locally declared String / Number / Boolean / BigInt shadows the global and suppresses the call-form report.
Examples of incorrect code for this rule:
Examples of correct code for this rule: