要求模板表达式中的变量为“string”类型。
// code-linter.json5
{
"rules": {
"@typescript-eslint/restrict-template-expressions": "error"
}
} const arg: string | undefined = 'foo';
export const msg1 = `arg = ${arg}`;
export const msg2 = `arg = ${arg || 'default'}`;