Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Researching

Nicholas Nelson nelsonni

🤓
Researching
View GitHub Profile
@JLarky
JLarky / action.ts
Last active Dec 17, 2019
type safe redux actions (typescript)
View action.ts
// like typesafe-actions
export type AnyAction<T extends string, A> = A & {
type: T;
};
export function createAction<T extends string, P, AC extends (...args: any[]) => AnyAction<T, P>>(
type: T,
map: AC
): AC & { type: T } {