Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Clarify multiple signature support in Sorbet

see #18
  • Loading branch information
hdoan741 committed Jun 21, 2019
1 parent 7d1dc5c commit d81ba47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The generation task currently creates the following signatures:

### `find`, `first` and `last`

These 3 methods can either return a single nilable record or an array of records. Sorbet does not allow us to define multiple signatures for a function. It doesn't support defining one function signature that has varying returning value depending on the input parameter type. We opt to define the most commonly used signature for these methods, and monkey-patch new functions for the secondary use case.
These 3 methods can either return a single nilable record or an array of records. Sorbet does not allow us to define multiple signatures for a function ([except stdlib](https://github.com/chanzuckerberg/sorbet-rails/issues/18)). It doesn't support defining one function signature that has varying returning value depending on the input parameter type. We opt to define the most commonly used signature for these methods, and monkey-patch new functions for the secondary use case.

In short:
- Use `find`, `first` and `last` to fetch a single record.
Expand Down

0 comments on commit d81ba47

Please sign in to comment.