Skip to content

Commit

Permalink
Merge pull request #795 from scala-js/prefer-overloads
Browse files Browse the repository at this point in the history
Mention preference for overloads in contrib doc
  • Loading branch information
armanbilge authored Jul 26, 2023
2 parents d157768 + 9f55fd0 commit 2275dba
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 2275dba

Please sign in to comment.