Skip to content

Commit 2103250

Browse files
Add ISplitAction type
1 parent eac0e6b commit 2103250

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/reducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Reducer } from 'redux';
2-
import { ISplitState, IStatus } from './types';
2+
import { ISplitAction, ISplitState, IStatus } from './types';
33
import {
44
SPLIT_READY, SPLIT_READY_WITH_EVALUATIONS, SPLIT_READY_FROM_CACHE, SPLIT_READY_FROM_CACHE_WITH_EVALUATIONS,
55
SPLIT_UPDATE, SPLIT_UPDATE_WITH_EVALUATIONS, SPLIT_TIMEDOUT, SPLIT_DESTROY, ADD_TREATMENTS,
@@ -106,7 +106,7 @@ export const splitReducer: Reducer<ISplitState> = function (
106106
state = initialState,
107107
action,
108108
) {
109-
const { type, payload: { timestamp, key, treatments, nonDefaultKey } = {} as any } = action as any;
109+
const { type, payload: { timestamp, key, treatments, nonDefaultKey } = {} } = action as ISplitAction;
110110

111111
switch (type) {
112112
case SPLIT_READY:

src/types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,13 @@ export interface ITrackParams {
195195
}
196196

197197
export type ISplitFactoryBuilder = (settings: SplitIO.IBrowserSettings | SplitIO.INodeSettings) => SplitIO.ISDK;
198+
199+
export type ISplitAction = {
200+
type: string;
201+
payload: {
202+
timestamp?: number;
203+
key?: string;
204+
treatments?: SplitIO.TreatmentsWithConfig;
205+
nonDefaultKey?: boolean;
206+
};
207+
}

0 commit comments

Comments
 (0)