2
0
Эх сурвалжийг харах

Add code style rule for multiple return types

David Baker 1 жил өмнө
parent
commit
3a159beb21
1 өөрчлөгдсөн 4 нэмэгдсэн , 0 устгасан
  1. 4 0
      code_style.md

+ 4 - 0
code_style.md

@@ -224,6 +224,10 @@ Unless otherwise specified, the following applies to all code:
         // ...
     }
     ```
+37. Avoid functions whose behaviour / return type varies with different parameter types.
+    Multiple return types are fine when appropriate (eg. SDKConfig.get() with a string param which
+    returns the type according to the param given) but SDKConfig.get() with no args returning the
+    whole config object is not: this could just be a separate function.
 
 ## React