no-base-to-string
Configuration
rslint.config.ts
Rule Details
Require .toString() and .toLocaleString() to only be called on objects which provide useful information when stringified. JavaScript calls toString() implicitly in string contexts such as template literals and string concatenation. The default Object.prototype.toString() returns "[object Object]", which is rarely useful.
This rule uses type information to detect when a value will use the base Object.prototype.toString() and flags string concatenation, template literals, explicit .toString()/.toLocaleString() calls, String() calls, and .join() on arrays containing such types.
Examples of incorrect code for this rule:
Examples of correct code for this rule: