Open
Description
TypeScript Version: 3.5.1
Search Terms: template string, template literal, Object.create(null)
Code
`${Object.create(null)}`
Expected behavior: TypeError
, as the object passed to the template string has no toString
method in the prototype chain (as it has no prototype chain at all).
Actual behavior: Everything goes well in the compiler, but JavaScript reports runtime error (ex. TypeError: Cannot convert object to primitive value
in Chrome).
Playground Link: https://www.typescriptlang.org/play/index.html#code/AYEg3g8gRgVgpgYwC4DoECc4EMlwBQB2ArgDYkCUAvsEA