-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
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.
class Control extends React.Component<any, any> {
render() {
return <button onClick={() => buttonClicked(Control)}>Button</button>;
}
}
function buttonClicked(controlType: typeof React.Component) {
}
It is compiled using a tsconfig.json file:
{
"compilerOptions": {
"noImplicitAny": true,
"jsx": "react"
}
}
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.
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug