Created
July 14, 2020 10:47
-
-
Save medfreeman/41173b560fc2a29c476552af46d3e72b to your computer and use it in GitHub Desktop.
Generator sequence in typescript
This file contains hidden or 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
export function* sequence<T extends readonly unknown[] = readonly unknown[]>( | |
sagas: readonly ((...args: T) => Generator<unknown, void>)[], | |
args: T | |
) { | |
for (const saga of sagas) { | |
yield* saga(...args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment