🔎 Search Terms
Generic constraints
template literals
🕗 Version & Regression Information
5.1.6
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.2.0-beta&ssl=9&ssc=111&pln=1&pc=1#code/C4TwDgpgBMELZgDYENYBkCWsBOzEHkAjAKwgGNgoBeKAJXIHtsATAHigAMASAbwGdg2DADsA5gF8A+rwFCx4jgBpkwkAD4oAek1QmUHlADaAaygAuTjMEiJ0-tfkcAuhZUgo4gFCeyDYQJgIAQAGan1kCLMARgAmAGZxKD5UDD4AMwwgwIQUdCwIXAISckptKALsJgsAFXBoAHIDCOQLYQBXOEICgG4PeqhmBizhBkpk4FS092AAC2gIAA9ICghmGDqoetgc1AhMHDx6gDpqufLsSuwoVKhkPnKlktWoI+9QSCg0hgZWaofYYTMe7bJC7fYFPBEUgUDQ0P5vDawARRMJfH48ZrReLiDRaHRQAASDA+sxuNxU50uRygACFyMg2nxoEjgKEAO4YRCIKDYCBgJiUCkVJgIklBYAxMIYyKxBL-CCA4HwUF5A5FaGUAD8MGwbWgFjSeCZeKgt0QfAYSRmDDaiDWXU+RogigAwm0LgrgIh3DdBHqgA
💻 Code
typetemplateLiteralObject=Record< `${string}_${string}`,any>// or { [k : `${string}_${string}`]: any }consttest0={aaa:123}satisfiestemplateLiteralObject// error: Type '{ aaa: number; }' does not satisfy the expected type 'templateLiteral'.The error is as expected .typefoo<TextendstemplateLiteralObject>=Ttypetest1=foo<{aaa:123}>// Hope this is an error. Because test0 will report an errortypetest2={aaa:123}extendstemplateLiteralObject ? true : false// also should be false,Currently is true🙁 Actual behavior
test0 throw error: Type '{ aaa: number; }' does not satisfy the expected type 'templateLiteral'.
but test1 No error reported
🙂 Expected behavior
Hope test1 reported an error
Additional information about the issue
No response
🔎 Search Terms
Generic constraints
template literals
🕗 Version & Regression Information
5.1.6
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.2.0-beta&ssl=9&ssc=111&pln=1&pc=1#code/C4TwDgpgBMELZgDYENYBkCWsBOzEHkAjAKwgGNgoBeKAJXIHtsATAHigAMASAbwGdg2DADsA5gF8A+rwFCx4jgBpkwkAD4oAek1QmUHlADaAaygAuTjMEiJ0-tfkcAuhZUgo4gFCeyDYQJgIAQAGan1kCLMARgAmAGZxKD5UDD4AMwwgwIQUdCwIXAISckptKALsJgsAFXBoAHIDCOQLYQBXOEICgG4PeqhmBizhBkpk4FS092AAC2gIAA9ICghmGDqoetgc1AhMHDx6gDpqufLsSuwoVKhkPnKlktWoI+9QSCg0hgZWaofYYTMe7bJC7fYFPBEUgUDQ0P5vDawARRMJfH48ZrReLiDRaHRQAASDA+sxuNxU50uRygACFyMg2nxoEjgKEAO4YRCIKDYCBgJiUCkVJgIklBYAxMIYyKxBL-CCA4HwUF5A5FaGUAD8MGwbWgFjSeCZeKgt0QfAYSRmDDaiDWXU+RogigAwm0LgrgIh3DdBHqgA
💻 Code
🙁 Actual behavior
test0 throw error: Type '{ aaa: number; }' does not satisfy the expected type 'templateLiteral'.
but test1 No error reported
🙂 Expected behavior
Hope test1 reported an error
Additional information about the issue
No response