Hi all
I tried to translate the following code:
import {MDCTextField} from '@material/textfield';
const textField = new MDCTextField(document.querySelector('.mdc-text-field'));
into Reasonml:
type mdcTextFieldCl;
[@bs.new] [@bs.module "@material/textfield"] external mdcTextField : Dom.element => mdcTextFieldCl = "MDCTextField";
let textField = switch (DocumentRe.getElementById("coin-amount-input")) {
| Some(a) => mdcTextField(a)
| None => raise("Can not find the element")
};
But the compiler complains:
We've found a bug for you!
/home/developer/Desktop/reasonreact/cockpit/src/Inputs/CoinAmount.re 7:1-9
5 │
6 │ let textField = switch (DocumentRe.getElementById("coin-amount-input"))
{
7 │ | Some(a) => mdcTextField(a)
8 │ | None => raise("Can not find the element")
9 │ };
This pattern matches values of type
option('a)
but a pattern was expected which matches values of type
DocumentRe.t => option(Dom.element)
ninja: build stopped: subcommand failed.
>>>> Finish compiling(exit: 1)
What am I doing wrong?
Thanks