Closed
Description
Bug Report
π Search Terms
bug extends symbols template literal
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about symbols
β― Playground Link
Playground link with relevant code
π» Code
type StringOrSymbol = string | symbol;
function getKey(key: StringOrSymbol) {
return `${key} is the key`; // Error: Implicit conversion of a 'symbol' to a 'string' will fail at runtime.
}
function getKey2<S extends StringOrSymbol>(key: S) {
return `${key} is the key`; // No error
}
π Actual behavior
When using a value of a generic type that extends symbol there is no error on usage in template literal.
π Expected behavior
It is expected that the error "Implicit conversion of a 'symbol' to a 'string' will fail at runtime." is thrown when using a generic type that extends symbol in a template literal.