How to fix FlowJS error for dynamic Boolean variable assignments?

titogeo
//Person Type  
type Person{
    canDisplayButton:boolean,
    anotherEmail:string
}

const canEdit:boolean = person.canDisplayButton && data.anotherEmail;

Flow throws an error saying anotherEmail: string (This type is incompatible with boolean)

How can this be fixed?

Ben R.

If you're trying to determine whether data.anotherEmail is defined, can you not use !!data.anotherEmail to determine truthiness of the variable?

Collected from the Internet

Please contact javaer1[email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to fix this Error: '_InternalLinkedHashMap<dynamic, dynamic>' is not a subtype of type 'Map<String, dynamic>'

How to fix this 'Call to a member function row() on boolean' error?

How to fix "Error: ';' expected" or "Error: ')' expected" and errors in the boolean

Getting error "local variable referenced before assignment - how to fix?

How to fix the error "unknown variable datadir" in mysql on raspbian?

How to fix compile error "This function or variable may be unsafe" (strcpy)

How to fix array boolean error using filter function

How to fix "segmentation fault (core dumped)" error when accessing a string variable within a struct within a dynamic array

How to handle failed variable assignments in powershell?

How to fix the error argument of type boolean or undefined using react and typescript?

How to fix the error undefined variable "$labels"in Prometheus?

How to execute many variable assignments from JSON and if key error assign None and execute rest of all in python

How does one fix a "Variable not in scope" error?

PHP error undefined variable notice how to fix?

How to fix the 'variable' was not declared in this scope error?

Haskell: How to fix the "type variable ambigous" compiler error?

Understanding how to calculate the total with variable assignments

FlowJS: How to use union types and boolean literals

How to get "at most once" semantics in variable assignments?

Difference between dynamic boolean expression variable and boolean function

how fix this error "Undefined variable: products (0)"

(Flutter) How to fix RenderFlex Error caused by Dynamic GridView Builder

How to fix an error in a php variable? Server gives 500 error

How to fix Dynamic Query error for progress 4gl?

How are variable assignments detected in a function?

How to fix boolean value?

How to fix Error: Non-nullable variable to be used?

How to get a compiler error for assignments in an if statement?

How to fix error: A value of type Iterable can't be assigned to a variable of type 'List<dynamic>'?