Skip to content

Commit

Permalink
Merge pull request #27452 from element-hq/dbkr/multi_return_type_rule
Browse files Browse the repository at this point in the history
Add code style rule for multiple return types
  • Loading branch information
dbkr authored May 13, 2024
2 parents a10f2e1 + 5f1f018 commit 35046bb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ Unless otherwise specified, the following applies to all code:
}
```

37. Avoid functions whose fundamental behaviour varies with different parameter types.
Multiple return types are fine, but if the function's behaviour is going to change significantly,
have two separate functions. For example, `SDKConfig.get()` with a string param which returns the
type according to the param given is ok, but `SDKConfig.get()` with no args returning the whole
config object would not be: this should just be a separate function.

## React

Inheriting all the rules of TypeScript, the following additionally apply:
Expand Down

0 comments on commit 35046bb

Please sign in to comment.