Undefined variables inside React component callbacks have a wrong type
bsansouci opened this issue · comments
Benjamin San Souci commented
It seems like if I have a callback in my react component, I can reference undefined variables without the extension seeing a problem and it even has a type:
Js.Fn.arity1<
option<React.element> => unit
>
type arity1<'a> = {I1: 'a}
This react component is inline in a call to a arity1 function showModal(. <Component ... />)
which might be relevant.
If I do the same in a more normal spot, at the bottom of my functional component, I get a similar behavior but with this type instead:
(
string,
~props: option<ReactDOMRe.props>,
array<React.element>
) => React.element
If I cmd+click it, it jumps to ReasonReact's createElement
external function
Cristiano Calcagno commented
Does it compile, and is it saved?
Benjamin San Souci commented
It doesn't compile no, because the variable doesn't exist. And yes it was saved