Skip to content

Commit 0198603

Browse files
committed
Update readme
1 parent 32f15eb commit 0198603

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

README.md

+22-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
# experimental-rescript-webapi
2+
23
Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)
34

4-
## New approach to webapi bindings (TODO)
5+
## Getting started
6+
7+
Install the package using your favorite package manager:
8+
9+
```shell
10+
npm i -D @rescript/webapi@experimental
11+
```
12+
13+
and add `@rescript/webapi` to your `rescript.json`:
514

6-
1. Find out if it is possible to adapt https://github.com/microsoft/TypeScript-DOM-lib-generator to output `.res` files
7-
- One example output is here: https://github.com/microsoft/TypeScript/blob/main/src/lib/dom.generated.d.ts
8-
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).
9-
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.
10-
4. In essence, we apply the rescript-core way of doing things here once again, so doc tests can be implemented as well.
15+
```json
16+
{
17+
"bs-dependencies": [
18+
+ "@rescript/webapi",
19+
],
20+
"bsc-flags": [
21+
+ "-open Global"
22+
]
23+
}
24+
```
1125

12-
## TypeScript-DOM-lib-generator
26+
## Documentation
1327

14-
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.
28+
More information can be found on https://rescript-lang.github.io/experimental-rescript-webapi/

0 commit comments

Comments
 (0)