Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Nov 12, 2024
1 parent 32f15eb commit 0198603
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# experimental-rescript-webapi

Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)

## New approach to webapi bindings (TODO)
## Getting started

Install the package using your favorite package manager:

```shell
npm i -D @rescript/webapi@experimental
```

and add `@rescript/webapi` to your `rescript.json`:

1. Find out if it is possible to adapt https://github.com/microsoft/TypeScript-DOM-lib-generator to output `.res` files
- One example output is here: https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts
2. Try to type most things with records with which we can model inheritance, but for readability and performance's sake it will be better to keep type spread and the necessity for coercion at a minimum and rather duplicate field names (which should not be a problem when everything is generated) as well as identity functions (coercion can be expensive with big record fields).
3. 80/20 approach, we want to model the more common APIs in a way so that they are delightful to use while the more obscure ones can be harder to use, but those should still be documented well.
4. In essence, we apply the rescript-core way of doing things here once again, so doc tests can be implemented as well.
```json
{
"bs-dependencies": [
+ "@rescript/webapi",
],
"bsc-flags": [
+ "-open Global"
]
}
```

## TypeScript-DOM-lib-generator
## Documentation

The repository [TypeScript-DOM-lib-generator](https://github.com/microsoft/TypeScript-DOM-lib-generator) was originally forked into [nojaf/TypeScript-DOM-lib-generator](https://github.com/nojaf/TypeScript-DOM-lib-generator/tree/rescript) but has since been copied into `tools/TypeScript-DOM-lib-generator` for easier collaboration.
More information can be found on https://rescript-lang.github.io/experimental-rescript-webapi/

0 comments on commit 0198603

Please sign in to comment.