Browse Source

Add more principles.

pull/5/head
Oleksii Trekhleb 5 years ago
parent
commit
2628189ece
  1. 10
      README.md

10
README.md

@ -217,12 +217,16 @@ const guessWhatAgain = sum({}, []); // -> 0
_Bad 👎🏻_ _Bad 👎🏻_
```javascript ```javascript
function sum(a: number, b: number): number { function sum(a: number, b: number): ?number {
// Covering the case when we don't do transpilation and/or Flow type checks in JS.
if (typeof a !== 'number' && typeof b !== 'number') {
return undefined;
}
return a + b; return a + b;
} }
// This one fails during the transpilation/compilation. // This one should fails during the transpilation/compilation.
const guessWhat = sum([], {}); const guessWhat = sum([], {}); // -> undefined
``` ```
### 💩 You need to have an unreachable piece of code ### 💩 You need to have an unreachable piece of code

Loading…
Cancel
Save