Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.2.2&fileType=.tsx&code=MYGwhgzhAEBCkFNoG9oF8BQpIwCIICcBLANwQBNoEAPAFwQDtyZ4IlVNgB7BiW6AGZcu0ALzQGCAO5xEACgCUAbiw8%2B0AEZgCYidOj5iZcopUADACTIhXNFa0E0ZpUA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6aFfKsu-RAW2LwAhn3oAPYh2TJKAeyaoMAbXDYciaNDnRIAGjXrgUYfHhyA7ujDLIAIWHJEkALoBfQ2BdqPboA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
class Base { }
class Derived extends Base { }
const foo = new Base();
const bar = new Derived();
`${foo}${bar}`;
ESLint Config
{
"rules": {
"@typescript-eslint/restrict-template-expressions": [
"error",
{ "allow": ["Base"]}
]
}
}
tsconfig
Expected Result
No warnings - if Base is allowed and every instance of Derived is also a Base, then Derived should be allowed. (This would also be consistent with the no-base-to-string rule - see #11520.)
Actual Result
Invalid type "Derived" of template literal expression. 5:10 - 5:13
Additional Info
No response
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.2.2&fileType=.tsx&code=MYGwhgzhAEBCkFNoG9oF8BQpIwCIICcBLANwQBNoEAPAFwQDtyZ4IlVNgB7BiW6AGZcu0ALzQGCAO5xEACgCUAbiw8%2B0AEZgCYidOj5iZcopUADACTIhXNFa0E0ZpUA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6aFfKsu-RAW2LwAhn3oAPYh2TJKAeyaoMAbXDYciaNDnRIAGjXrgUYfHhyA7ujDLIAIWHJEkALoBfQ2BdqPboA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
ESLint Config
tsconfig
{ "rules": { "@typescript-eslint/restrict-template-expressions": [ "error", { "allow": ["Base"]} ] } }Expected Result
No warnings - if
Baseis allowed and every instance ofDerivedis also aBase, thenDerivedshould be allowed. (This would also be consistent with theno-base-to-stringrule - see #11520.)Actual Result
Additional Info
No response