-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ts-migrate adding setState: any
type declaration to react component classes, causing compilation problem
#100
Comments
It looks like this can happen if the React types package ( It might be nice if ts-migrate could install I'm surprised that I wonder if classes that inherit from a base class with unknown types should use |
this was on a ~50 or so component project using in particular i cant remember if i went through the |
Thanks, I think I have an idea of what could cause this issue. If you specify It looks like even including The only kinda decent fix for this that I can see is adding an index signature when we encounter this case: class Component extends React.Component {
[k: string]: any;
// ...
} In the above case it's pretty avoidable if you install |
After a ts-migrate on my project, I observed react classes with
setState: any
would compile to havethis.setState = void 0;
in their constructor, leaving you with "TypeError: this.setState is not a function` errorsThe text was updated successfully, but these errors were encountered: