Open iddan opened 6 years ago
Not a bug.
Type of type
is "teacher" | "student"
as expected.
Yes, but why doesn't "student" conform to it?
Well, looks like a problem indeed. You can remove the error if you type the function return type explicitly though.
Seems as though whilst flow says it's inferring the type of type here as 'student' | 'teacher'
it's not checking with it correctly (or something along those lines).
Set up 3 different scenarios in a flowtry. As displayed there it seems partially connected to the way flow resolves the return type. And even though it does say it has the correct type there, it's checking on it wrongly.
Just leaving this here as my findings on the subject whilst I was messing about with it. Seems like a bug worth fixing.
Regression from Flow 0.55.0
I expect properties to inherit union types