-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitter
Milestone
Description
Type inference is not working for the ref
callback prop.
I believe this is the same issue as in #7088, which was fixed over a year ago.
TypeScript Version: 2.3.2
Code
// A *self-contained* demonstration of the problem follows...
class Other extends React.Component<any, any> {
render() {
return <div />;
}
}
class Container extends React.Component<any, any> {
private _ref: Other;
render() {
// Parameter 'ref' implicitly has an 'any' type.
return <Other ref={ ref => this._ref = ref } />;
}
}
Expected behavior:
Type of parameter ref
should be inferred as Test
Actual behavior:
Parameter 'ref' implicitly has an 'any' type.
flatline, xuan9230, gianpaj and catamphetamine
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRelates to the JSX parser and emitter