Skip to content

Commit 62bc8a5

Browse files
authored
fix contract function type
1 parent b593d7c commit 62bc8a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,13 @@ A contract specifies the obligations and guarantees of the behavior from a funct
346346
// Define our contract : int -> boolean
347347
const contract = (input) => {
348348
if (typeof input === 'number') return true
349-
throw new Error('Contract violated: expected int -> int')
349+
throw new Error('Contract violated: expected int -> boolean')
350350
}
351351

352352
const addOne = (num) => contract(num) && num + 1
353353

354354
addOne(2) // 3
355-
addOne('some string') // Contract violated: expected int -> int
355+
addOne('some string') // Contract violated: expected int -> boolean
356356
```
357357

358358
## Category

0 commit comments

Comments
 (0)