Closed
Description
Repro
{
"rules": {
"@typescript-eslint/restrict-template-expressions": "error"
}
}
type MyString = string & { kind: "MyString" };
const myString = "x" as MyString;
console.log(`myString: ${myString}`); // False positive "Invalid type of template ..."
Expected Result
No error.
Actual Result
"Invalid type of template literal expression"
Additional Info
Real-world example:
import { Term } from "sparqljs";
const someTerm = "x" as Term;
console.log(`someTerm: ${someTerm}`);
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
2.25.0 |
@typescript-eslint/parser |
2.25.0 |
Proposed solution
Don't emit an error if any item of the intersection type is "allowed" in respect to the options.