rescript-lang / rescript-editor-support

Command line to support editor integration for Rescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined variables inside React component callbacks have a wrong type

bsansouci opened this issue · comments

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}

Screen Shot 2020-11-19 at 08 57 56

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

Does it compile, and is it saved?

It doesn't compile no, because the variable doesn't exist. And yes it was saved