You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actual behavior:
Error TS7023: 'render' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
The problem does not happen if the onClick callback is given through an intermediary variable, instead of being inlined.
The text was updated successfully, but these errors were encountered:
The compiler tries to figure out the return types of functions from the type of their return expressions. this can depend on figuring out other types. sometimes that could lead to cycles; the compiler breaks these by giving the type any. this can be solved by adding an explicit type annotation, something like render(): JSX.Element { .. }.
TypeScript Version:
1.8.10
Code
This code uses the React type definitions via
tsd install react-global
Unfortunately I could not reproduce the problem in a simpler setting, such as using a plain base class, without React and TSX.
It is compiled using a tsconfig.json file:
Expected behavior:
No compile errors.
Actual behavior:
Error TS7023: 'render' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.
The problem does not happen if the onClick callback is given through an intermediary variable, instead of being inlined.
The text was updated successfully, but these errors were encountered: