-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I like the look of raj and want to try it out :-). However since I use typescript I cannot try anything until I have types. So here is my initial attempt at typings for raj:
export type Change<S, M> = [S, Effect<M>?];
export interface Effect<M> {
(dispatch: Dispatch<M>): void;
}
export interface Update<M, S> {
(message: M, state: S): Change<S, M>;
}
export interface View<M, S, V> {
(state: S, dispatch: Dispatch<M>): V;
}
export interface Dispatch<M> {
(message?: M): void;
}
export interface Done<S> {
(state: S): void;
}
export interface Program<S, M, V> {
readonly init?: Change<S, M>;
readonly update: Update<M, S>;
readonly view: View<M, S, V>;
readonly done?: Done<S>;
}
export function runtime<S, M, V>(program: Program<S, M, V>): void;
You can see them in use in my experiment repo.
Any feedback on the typings are welcome. It would be nice if they could be added to the package once they are reviewed fully.
Metadata
Metadata
Assignees
Labels
No labels