Generic indexed access on a substitution type with an array constraint resolves incorrectly #55383
Labels
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π Search Terms
indexed access substitution type array constraint
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/C4TwDgpgBAMglsCAnAhgGwCrmgXigZ2CTgDsBzKAHyhIFcBbAI2SqkYHt20IUSBuAFChIUAGrpaEAOIRgiJAB5xaSVhEQAHohIATfLATJ0a3AfnHsAPih4AFAEob15auyCh2KAGUAxgAsIehQbb39AlABBJFQQVl8AoIB5RgArCB9gVnhzTDcPEXjwqJiQ4pQQBUKk1PTM6irI6PKsw1RcyEtBYWgG5LSMkIBvASgoAG0AawgQAC4CIlIyAF053pqB+rCgstjqbKN2iEEAX3duqABJEgAzZBcIfAAxJHZ6BsqoTW09UISUazwXk+Wggun0+zaJhGUAA-GIJNJZPJKpZoatgd99A0dtC4cNRgTxgBpKCkKBTEDsa7eFaXG53BFPF5vLYoSpjIlLTrQ0bHNHeDGgn5rfrAXFQfGE4mkkjk6ZUmlzK63JD3Jmvd5eDlcwSEvmjOYkCAAN2QgiAA
π» Code
π Actual behavior
an error is reported:
π Expected behavior
There should be no error,
S[K]
should satisfySchema
constraint (at least since #48837 )Additional information about the issue
A variant with an additional type alias for that array branch works OK: TS playground.
The text was updated successfully, but these errors were encountered: