discriminated union type narrow when destructuring object within desturct array #55664
Labels
Experimentation Needed
Someone needs to try this out to see what happens
Suggestion
An idea for TypeScript
Milestone
π Search Terms
destructuring object within destructured array, discriminated union
π Version & Regression Information
the error part appeared in every version I tried
β― Playground Link
https://www.typescriptlang.org/play?target=1&ts=5.2.2#code/C4TwDgpgBAYglgJwM7AJLAgWygXigbwCgopRIAuKAcgDNEUrioA3AQwBsBXCSlBOAHYBzQgF9ChMtADKEAMYB7AQBN0WXASZTKVJPKXLGJNlx5QBnTACMICMRKlQAKgAtEqjNjxES26sDcEQyYTbkorBQV2CFYBe0JFARQoVkoACnhkNE8oAB8oWUSPdXzXdzVMAEoAbQBdDTqJAHom0ghkgEZCVgA6GgUEAFFWORc0tPxScAgAGhYObihRStwAPk0SOBooNMccfeo6LKoVnxIoFqgFAGteYH5hJhJEpCiIHvYFITTQiEqmcTLZqtDDJABMhH6CB2L2ABCmkDmvyWV22rFOTC2Oz2B1o9GAJw250uNzuDxE5ygLzeHy+PwWfwB8QSSmSVko1Vg+IqeQK+hUPNKgWK2FqdQatWBbWSAGZIQMYay4ZzmFB6gptlYMZttj8eji8Hjjtria0bk8qayaZ9vswer9-iRAVLQXCACyEKx9AbDUbjaqTKRIhlLWorHDrM5Y3bTXC4o4ME0kS4CBRw0lQPiCIS8izWWy8iJvWIW6nRWm2hmOpZif6ES6uqAAVnl0LSsKgnMD02DphR6s1JujBsO+MJZ2TrVT6dumfu2dzlhs0PyReiJcpZfeNvppmrgKAA
π» Code
π Actual behavior
the code above, test4 and test5 can not narrow to the
string
type like test1, test2 or test3π Expected behavior
I expected the
value
in the loop to infer successfullyAdditional information about the issue
No response
The text was updated successfully, but these errors were encountered: