rescript-lang / rescript-lang/experimental-rescript-webapi

Consider adding useful extension module

Open
#5 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ReScript
Stars
40
Forks
11
Avg merge
3d 12h
Merged PRs (30d)
12

Description

While the aspiration of this project is to have bindings for anything available in the browser, it might be interesting consider having an additional auxiliary module.

Or to phrase it differently: some API methods are shit. Like https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement. You pass it any string and get an element back. Maybe you want to create something more specific and get a better type back like document.createElement("input") and get HTMLInputElement back.

So having something like:

type document

type htmlInputElement

@scope("document")
external createInputElement: (unit, @as("input") _) => htmlInputElement =
  "createElement"

let i = createInputElement()

The input string can't be misspelled and the return type is better.
Perhaps each current API module can have an APIExt companion module?
Let me know what you thoughts.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the existing API modules and the proposed createElement/createInputElement example. Decide the scope and design for any APIExt companion modules; done means the intended module structure and supported typed helpers are agreed and clearly specified.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.