Skip to content

Mention preference for overloads in contrib doc #795

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ Please:
* Use `def` for read-only properties unless there is a compelling reason it should be a `val`
(i.e., the spec definitively states it is constant)
* Use `Double` for integer-values that can fall outside the range of `Int`
* Prefer adding overloads instead of using union `|` types for method and constructor parameters. For example:
```diff
- def createElement(tagName: String, options: String | ElementCreationOptions = js.native): Element = js.native
+ def createElement(tagName: String): Element = js.native
+ def createElement(tagName: String, options: String): Element = js.native
+ def createElement(tagName: String, options: ElementCreationOptions): Element = js.native
```
* Add scaladocs via copy-paste from MDN


Expand Down