restrict-template-expressions
Configuration
rslint.config.ts
Rule Details
Enforce template literal expressions to be of string type. When using template literal expressions (${expr}), non-string values are implicitly converted to strings using their .toString() method. This can lead to unexpected results such as "[object Object]" for objects or "null" for null values. This rule ensures that only values of type string are used in template expressions by default, though other types can be allowed via options.
Examples of incorrect code for this rule:
Examples of correct code for this rule: