TypeError: Cannot read property 'bind' of undefined when using Flow
Created by: Gpx
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
flow
bind
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 10.11.0
Yarn: Not Found
npm: 6.4.1
Watchman: 4.7.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.5.2 => 16.5.2
react-dom: ^16.5.2 => 16.5.2
react-scripts: 2.0.1 => 2.0.1
Steps to Reproduce
- Create a component like this one
class Foo extends React.Component {
constructor(props) {
super(props)
this.foo = this.foo.bind(this)
}
foo: () => ()
foo() {}
render() { return <div /> }
}
- Run the tests for
Foo
TypeError: Cannot read property 'bind' of undefined
Expected Behavior
The file should run in the tests
Actual Behavior
I think Flow's syntax is confusing the tests. Note that this same code was working in the previous version of CRA
Reproducible Demo
Simply clone https://github.com/Gpx/cra2-bind and run the tests