You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot do any refinement to find out which type I'm working with and silence flow
How to reproduce
// @flowimport{typeRecordOf,}from"immutable";typeT1Props={type: "t1",stuff: string};typeT2Props={type: "t2",stuff: string,moreStuff: string};typeT1=RecordOf<T1Props>;
type T2=RecordOf<T2Props>;functionsomeFunc(test: T1|T2){if(test.type==="t2"){// Cannot get `test.moreStuff` because: Either property `moreStuff` is missing in `RecordInstance` [1]. Or property `moreStuff` is missing in `T1Props` [2]console.log(test.moreStuff);}// all branches are incompatible: Either property `moreStuff` is missing in `RecordInstance` [1]. Or property `moreStuff` is missing in `T1Props` [2].if(test.moreStuff){console.log("We have t2");}}
I was able to use a simple if to see if a property exists but now that I'm trying to upgrade to 4.0.0 I cannot find a way that works.
The text was updated successfully, but these errors were encountered:
What happened
Cannot do any refinement to find out which type I'm working with and silence flow
How to reproduce
I was able to use a simple
if
to see if a property exists but now that I'm trying to upgrade to 4.0.0 I cannot find a way that works.The text was updated successfully, but these errors were encountered: