Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save r-k-b/5ab5052bee16ff6f4d5cf09a16c458fc to your computer and use it in GitHub Desktop.
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
// 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