-
Notifications
You must be signed in to change notification settings - Fork 8
Add typings file #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add typings file #32
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| 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>; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One issue with generic I'm not saying this is wrong, just something to consider. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this only makes sense if we consider There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the typings for |
||
| readonly done?: Done<S>; | ||
| } | ||
|
|
||
| export function runtime<S, M, V>(program: Program<S, M, V>): void; | ||
Uh oh!
There was an error while loading. Please reload this page.