変数の埋め込みがない場合はバッククオート(テンプレート文字列)ではなく、クォーテーションマーク(文字列リテラル)を使用します。
エラー例
console.log(`WARN ` + name + ` is null.`);
解決方法
-
バッククオート(テンプレート文字列)をクォーテーションマーク(文字列リテラル)に変更します。
console.log('WARN ' + name + ' is null.');
-
変数を埋め込みます。
console.log('WARN ${name} is null.');
-
tslintの "quotemark" 設定から、"avoid-template"オプションを削除します。
tslint.json
{ "rules": { "quotemark": [ true, "single", "avoid-template" <- 削除する ] } }
検証環境
- typescript 2.6.2
- tslint 5.9.1
- Microsoft Windows 7 Professional Service Pack 1 (Microsoft Windows NT 6.1 (7601))