profile
viewpoint

Ask questionsType refinement stopped working in 0.125

Flow version: 0.125

Expected behavior

The type refinement works as expected (it did in 0.124). In the last version methods written like this produced the expected return type based on the type parameter that was passed. Now, these methods fail the type check.

Actual behavior

Type error.

  • Link to Try-Flow or Github repo: https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVAXAngBwKZgCCYAvGAN6phjb4BcYA5IY6gL7q0EBCpFVNXHgaNurDpiFgAKkICyAQxx9K1Qg0IAaAdwbd2nKQAU4AZ1MBLAEYw8s-Kb4ASANJ4spgDz28inAD5DfBkhRzJiAB8wfVQoAFcAOwBjDAs4BLAkgCc8BQw8bwYTc2tbH1N-AAouBmkASgYnAFFbAFs8BIwfb3klTRl-fmok9NMMGgALCwSAcz5s3PyAcQ68LIsk6qE6gQELKGqp2YA6LjAAQhIyLjqh6kmsxDAEvCQmrMesysYER9nBfCMHbUDjUAQ5DBxLIZDBHGYGWKJFJpDILPJ4FYvdabGpgYqWGx2UINIhgKK8VRgUwICwYJITLb4W6U4YKUwEZiMBgQqEZSrkLhsDTA+5JNkcsTcvCQ6FgfmCvQi+5gATUAAmeCgCjiMAwDFhjyQLzeHzgXx+fzmXCBAg4bCAA

You can see this even better here

If you change foo.isA to foo.isB you get a type error. Which is correct because after create('A') the result must be of type A and can't be B.

facebook/flow

Answer questions dsainati1

Good catch. Working on a fix

useful!

Related questions

Common spread pattern leads to "exponentially large number of cases" errors hot 1
Flow issue "Please upgrade flow to version >=0.75." hot 1
Object.fromEntries type defs missing hot 1
Cannot set defaultProps with React.memo and React.forwardRef hot 1
Inexact rest object claims it may have properties it can't possibly have hot 1
Inexact rest object claims it may have properties it can't possibly have hot 1
Inexact rest object claims it may have properties it can't possibly have hot 1
0.92.0 release crashes on startup (Unix.Unix_error) hot 1
module.name_mapper does not find nested modules on windows hot 1
Cannot import useState because there is no useState export in react. hot 1
Can't use a default value from a destructuring assignment as a computed property since 0.111 hot 1
Support optional chaining - flow hot 1
Flow issue "Please upgrade flow to version >=0.75." hot 1
Allow explicitly including a folder under an ignored path hot 1
Flow caches and fails to purge errors hot 1
source:https://uonfu.com/
Github User Rank List