TypeError: Cannot read property 'bind' of undefined when using Flow
See original GitHub issueIs 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
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'bind' of undefined, I can not ...
javascript - TypeError: Cannot read property 'bind' of undefined, I can not figure what this means. React js - Stack Overflow. Stack Overflow ......
Read more >What is "TypeError: Cannot read property 'state' of undefined"?
The error message says that you don't have the state property on an undefined object. To decode this, we have to understand the...
Read more >TypeError: Cannot read property 'bind' of undefined - Odoo
Traceback: TypeError: Cannot read property 'bind' of undefined at http://localhost:8069/web_editor/static/src/js/wysiwyg/root.js:46:57 at Function._.each._.
Read more >Data binding - Polymer Project
A data binding connects data from a custom element (the host element) to a property or attribute of an element in its local...
Read more >How to bind 'this' keyword to resolve classical error message ...
Basically this keyword inside a function is determined by looking at how the method is actually invoked. Usually in JavaScript, we invoked the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I understand. We’ll need to dig deeper into this.
@bugzpodder yep, that works, unfortunately, in my app, we use prettier which converts comments into standard type definitions. I think we’ll wait to update CRA until this issue has been closed