Created
October 3, 2016 07:34
-
-
Save r-k-b/5ab5052bee16ff6f4d5cf09a16c458fc to your computer and use it in GitHub Desktop.
Array destructuring into args doesn't seem to play nice with Typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ramda 0.22.1 | |
// typescript 2.0.3 | |
import {pipe, add, multiply, identity} from 'ramda'; | |
// both f1 & f2 are valid JS, but typescript doesn't like f1... | |
// `Error:(13, 10) TS2346:Supplied parameters do not match any signature of call target.` | |
let x = 3; | |
let fns = [add(1), multiply(2)]; | |
let f1 = pipe(...fns); | |
let f2 = pipe(add(1), multiply(2)); | |
console.log('f1(x):', f1(x)); | |
console.log('f2(x):', f2(x)); | |
// Is it worth forcing typescript to accept it? | |
// (Is it even possible to do so?) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment