facebook / facebook/flow

Exact object shapes lost after refinement

Aperta
#5,280 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Typing: refinements
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

When inspecting [this repro](https://flow.org/try/#0PTAEAEDMBsHsHcBQiCmAPADrATgF1LgJ4YqgAKArgM4AWoAvKAN4A+iAkESQFygDkGajT4AaRCwC+ydFjwFipAEooqWAHZVSjVhy4pefbCvWbRHIwEcKK3AH0AlgBNeVXNntqA5mMnTMOfD1yIWVVWA0tZjZOBQNBWjN2S2tXB2dQV3cvHylUfzkggGVYAGMAaxRcAFkVKgBDT0jKWlAWUFCTUjbmmg7wzWQS-vwaOrVHaBQehlB4unoAPmYpUFW1xCGNEbGJlD6ImaMwg8XQTapYSYA6OE8ACiPOq+SbNIBKQeHQUfHJmqp6o0ZncALa1Br6UDFcqVf6AlBvBhLJgceyQUCg8GNK5Beh4-iPfooPiIlFrNbsH67faaTEAiEfclJSoUbBqRDklagDmgdhojFg+nYl6pJygACE+Io4xQkA8KEcpJ5TKpkxpKDp8MZFKMuFZ7M5yvJ3MpO0mPU1DMQEiAA)'s "bottom gutter" we can see that:

- on the 23th line it has a type of `{|type: 'push'|} | {|request_id: string, type: 'response'|} | {|request_id: string, type: 'push'|}` - all have exact shapes
- in the refined block on the 25th line the exactness seems to be lost and the inspected type is `{request_id: string, type: 'response'}`
- AFTER the refining if statement, so basically in other case on the 29th line it stays inexact - `{type: 'push'} | {request_id: string, type: 'push'}`

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.