From 87cd089ffc0109b7a67bf9ac415152a9be7d9181 Mon Sep 17 00:00:00 2001 From: Mike Ryan Date: Wed, 24 Apr 2019 19:56:04 -0500 Subject: [PATCH] feat(store): Expand createReducer type signature to support up to ten action creators --- modules/store/src/reducer_creator.ts | 133 +++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/modules/store/src/reducer_creator.ts b/modules/store/src/reducer_creator.ts index 39ecad5396..fe260a0521 100644 --- a/modules/store/src/reducer_creator.ts +++ b/modules/store/src/reducer_creator.ts @@ -31,6 +31,139 @@ export function on< creator3: C3, reducer: OnReducer ): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + reducer: OnReducer +): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + C5 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + creator5: C5, + reducer: OnReducer +): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + C5 extends ActionCreator, + C6 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + creator5: C5, + creator6: C6, + reducer: OnReducer +): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + C5 extends ActionCreator, + C6 extends ActionCreator, + C7 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + creator5: C5, + creator6: C6, + creator7: C7, + reducer: OnReducer +): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + C5 extends ActionCreator, + C6 extends ActionCreator, + C7 extends ActionCreator, + C8 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + creator5: C5, + creator6: C6, + creator7: C7, + creator8: C8, + reducer: OnReducer +): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + C5 extends ActionCreator, + C6 extends ActionCreator, + C7 extends ActionCreator, + C8 extends ActionCreator, + C9 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + creator5: C5, + creator6: C6, + creator7: C7, + creator8: C8, + creator9: C9, + reducer: OnReducer +): On; +export function on< + C1 extends ActionCreator, + C2 extends ActionCreator, + C3 extends ActionCreator, + C4 extends ActionCreator, + C5 extends ActionCreator, + C6 extends ActionCreator, + C7 extends ActionCreator, + C8 extends ActionCreator, + C9 extends ActionCreator, + C10 extends ActionCreator, + S +>( + creator1: C1, + creator2: C2, + creator3: C3, + creator4: C4, + creator5: C5, + creator6: C6, + creator7: C7, + creator8: C8, + creator9: C9, + creator10: C10, + reducer: OnReducer +): On; export function on( creator: ActionCreator, ...rest: (ActionCreator | OnReducer)[]