Open tom-sherman opened 2 years ago
See https://github.com/tinymce/rescript-webapi/pull/76#discussion_r776784274
I've taken different approaches for option bags depending on the optionality of the properties. My logic goes as follows:
- If there is only one property, use an object type. Mark it as required even if the API accepts an empty object
- If there is more than one property but they're all required, use an object type
- If there is more than one property and one or more are optional, use an option bag module
This library will be far from "complete" at v1 due to many missing bindings, but also it will be forever expanding as the web platform expands.
Couple this with the fact that ReScript bindings are not simpl typed declarations to existing JS (a la lib.dom.d.ts), they are more new APIs that model the underlying platform. It makes the API decisions of this library more of a creative and subjective endeavour than it may be in TypeScript-land.
That's a lot of words to say that I think a style guide is valuable. It would:
Maybe we can use this issue as a starting point for what would be included in this documentation.