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 1 commit
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
Prev Previous commit
Next Next commit
Add an example
Co-authored-by: zetashift <rskaraya@gmail.com>
  • Loading branch information
armanbilge and zetashift authored Jul 26, 2023
commit c25e13f38a5763a98e061e82139fbcc21d5db95f
7 changes: 6 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ 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
* 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