Skip to content

How can I create element and event?  #13

Description

@hellpirat

Playing around with rescript-webapi, stuck from the beginning.

I am using this repo - https://github.com/rescript-lang/rescript-project-template

Just copy-paste code from https://github.com/tinymce/rescript-webapi/blob/main/tests/Webapi/Dom/Webapi__Dom__EventTarget__test.re this file.

Get an error on 4th line:

 We've found a bug for you!
fun/rescript-project-template/src/Demo.res:4:14-21

  2 │ open EventTarget;
  3 │ 
  4 │ let target = document->Document.createElement("strong")->Element.asEvent
    │ Target;
  5 │ let event = Event.make("my-event");
  6 │ let handleClick = _ => print_endline("asd");

  This has type:
    Dom.document (defined as
      Dom.eventTarget_like<Dom._node<Dom._document<Dom._baseClass>>>)
  Somewhere wanted: string

FAILED: cannot make progress due to previous errors.

What I am doing wrong? :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions