flow icon indicating copy to clipboard operation
flow copied to clipboard

Library Definition Implicitly Getting "null | void" Added to Type

Open Tsmith18256 opened this issue 9 years ago • 1 comments

My Flow Version: 0.47.0

I am trying to create a Library Definition for the 'react-native-status-bar-size' library to use in my project:

https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVATApgYxgQwCcswBbODAVxhIHJj8cAXAWgDt8mBLANyxYDOTTpQEsARkUFcAXllpgA3qjBhseIiXJUaAOiwAPAA5xCTAQC4lK1WByVCxNkwASWLgHMAFkyttKpOJYhDYAvqjhqFykJmZgAMrCTKIAQkTxslgAkgDy8WBQhHCkYPRYjKwc3HyCSaISUgKZtADc6FBwcAAUiSICaYQZcrnxuvaOWM5unj4AlG2oUJRszFxwbAWdXQZ+AUGEs7uBwda2xMmEGwZt4UA

In the Try Flow sandbox, it is working perfectly, but I am getting an error in my project. By putting that exact declare module block in my flow-typed folder, it is being treated as if I did currentHeight: number | null | void.

The following 2 errors print out:

 23:     this.state = {
 24:       currentStatusBarHeight: StatusBarSizeIOS.currentHeight
 25:     };
         ^ object literal. This type is incompatible with
 23:     this.state = {
         ^^^^^^^^^^ object type
  Property `currentStatusBarHeight` is incompatible:
     24:       currentStatusBarHeight: StatusBarSizeIOS.currentHeight
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null. This type is incompatible with
     14:   currentStatusBarHeight: number
                                   ^^^^^^ number
 23:     this.state = {
 24:       currentStatusBarHeight: StatusBarSizeIOS.currentHeight
 25:     };
         ^ object literal. This type is incompatible with
 23:     this.state = {
         ^^^^^^^^^^ object type
  Property `currentStatusBarHeight` is incompatible:
     24:       currentStatusBarHeight: StatusBarSizeIOS.currentHeight
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ undefined. This type is incompatible with
     14:   currentStatusBarHeight: number
                                   ^^^^^^ number

Tsmith18256 avatar Jul 06 '17 18:07 Tsmith18256

This was likely fixed a while ago.

SamChou19815 avatar Feb 27 '23 16:02 SamChou19815