N8Brooks / combinatorics

🦕 Combinatorial generators including combinations, permutations, combinations with replacement, permutations with replacement, cartesian products, and power sets.
https://deno.land/x/combinatorics
MIT License
26 stars 1 forks source link

refactor: stronger typing for cartesian product #7

Closed N8Brooks closed 2 years ago

N8Brooks commented 2 years ago

Can possibly use TypeScript variadic generic tuples similar to how the Deno std collections module is for zip.

Example

The result of the following should be [string, number][]. It would require a little bit of tweaking, but this would currently result in (string | number)[].

const sequences = [...cartesianProduct('abc', [1,2,3])];
N8Brooks commented 2 years ago

This is technically a breaking change and should be committed as such.