You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interfaceNMap{1: "A";2: "B";3: "C";4: "D";}declareconstg: <Textends1|2|3>(x: `${T}`)=>NMap[T];typeG1=<Textends1|2|3>(x: `${T}`)=>NMap[T];constg1: G1=g;// should be oktypeG2=<Textends1|2|3|4>(x: `${T}`)=>NMap[T];constg2: G2=g;// should errortypeG3=<Textends1|2>(x: `${T}`)=>NMap[T];constg3: G3=g;// should be ok
π Search Terms
inference types texts template literal types generic constraint string
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.5.0-dev.20240316&ssl=17&ssc=24&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgHIFk4AdkG8BQyyAjAFzIBEAghQNyHIBM5FAQnQwMwsDCHRAFhYARDgF98+ACYQEAGzhQUCAPYgAzmGQBzcgB4AKsggAPSCCnqSyAD5NbyTgD4AFCfIADACS4DYjwCUyAC8TmiYWADaBgC69PhgAJ5YKADixCHIhsZmEBZWGXaMDs5unj5+gSFhGNjRcfiqGlraZMjpmdq0yAD0PcgqANaSSSntxcFZRqbmltZFJQ4Cru7I3r7+QaHhdbH0TZo6zOOd3X3GUFAqUCPJaZyZ2TN5c4VMK+UbVdu1UXuNakO2m47Qeky6vX6Q3wQA
π» Code
π Actual behavior
All of those assignments fail
π Expected behavior
Only the second assignment should fail
Additional information about the issue
Originally reported by @gabritto here: #56659 (comment)
The text was updated successfully, but these errors were encountered: