Skip to content

Commit

Permalink
v0.1.66
Browse files Browse the repository at this point in the history
  • Loading branch information
REllEK-IO committed May 14, 2024
1 parent 6aa80f4 commit f9fbb29
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/model/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export type ActionOptions = {
priority?: number;
};

export type ActionWithPayloadOptions = {
export type ActionWithPayloadOptions<T extends Record<string, unknown>> = {
semaphore?: [number, number, number, number];
conceptSemaphore?: number;
payload?: Record<string, unknown>;
payload?: T;
strategy?: ActionStrategy;
keyedSelectors?: KeyedSelector[];
agreement?: number;
Expand Down Expand Up @@ -190,9 +190,9 @@ function getSpecialSemaphore(type: ActionType) {
}
}

export function createAction(
export function createAction<T extends Record<string, unknown>>(
type: ActionType,
options?: ActionWithPayloadOptions,
options?: ActionWithPayloadOptions<T>,
): Action {
const special = getSpecialSemaphore(type);
const semaphore = options?.semaphore !== undefined ? options.semaphore : [0, 0, -1, special] as [number, number, number, number];
Expand Down Expand Up @@ -243,7 +243,7 @@ export function prepareActionWithPayloadCreator<T extends Record<string, unknown
payload: T,
options?: ActionOptions
): Action => {
const opt: ActionWithPayloadOptions = {
const opt: ActionWithPayloadOptions<T> = {
...options,
payload
};
Expand All @@ -253,9 +253,9 @@ export function prepareActionWithPayloadCreator<T extends Record<string, unknown
);
};
}
export type ActionCreatorWithPayload<T> = (
export type ActionCreatorWithPayload<T extends Record<string, unknown>> = (
payload: T,
options?: ActionWithPayloadOptions
options?: ActionWithPayloadOptions<T>
) => Action;

/**
Expand Down

0 comments on commit f9fbb29

Please sign in to comment.