menu

prefer-template

Prefer template literals for string concatenation

String concatenation separates authored text from interpolated values with binary operators. Instead, you SHOULD use one template literal containing the static and dynamic segments in their final order.

Reported

1function greet(name: string): string {2    return "hello, " + name;3}

Accepted

1function greet(name: string): string {2    return `hello, ${name}`;3}