Closed
Description
This looks like a type inference issue with tsc 1.8.0+ (also nightly), but I'm not sure. It could also be because of typings.
The offending code looks something like this:
// Inside React component
render() {
return <Overlay ref={ref => this.overlayEl = ReactDOM.findDOMNode(ref) as HTMLElement} />;
// error TS7006: Parameter 'ref' implicitly has an 'any' type.
}
I'm using ref "callback" syntax because the string-based syntax is deprecated by react and also not type safe. Needless to say, I have "noImplicitAny" enabled.
It looks like ref type is now an intersection between two types (relates to #5478), and the type inference no longer works, where previously it would be an instance of Overlay
.
I can work around this issue for now by manually passing the type, like (ref: Overlay) =>
, but it should work without it as well.