facebook / facebook/flow

Exact object shapes lost after refinement

Offen
#5,280 9 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Typing: refinements
Vorherrschende Sprache
Rust
Sterne
22.3k
Forks
1.9k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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'}`

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.