-
Notifications
You must be signed in to change notification settings - Fork 17
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
Typescript #76
Comments
I can do the PR |
and export declare function model<S extends Obj, K extends keyof S = keyof S, A extends FnMap = {}, V extends FnMap = {}>(name: string, { initial, actions, views }: ModelArgs<S, A, V>): (obj?: S | undefined) => S & A & V & Model<S>; in order to do export const ProductModel = model<TProduct>('Product', {
actions: (state) => ({
setSelected: (isSelected: boolean) => {
state.isSelected = isSelected
},
}),
}) |
Another problem: |
views also not typed |
Hey @prbxr not sure how I feel about making I could imagine passing let example = model('example', { initial: (param: { prop: boolean }) => param });
// ^ ^ `S` inferred from here
// | something like `Partial<S>`
example({ prop: true });
sure
It's hard, because it's not fixed
Views are not typed? |
Hello
I am using your wonderful library!
Would you like to update
to this
obj?: S | undefined
And setting initial as optional, here:
The text was updated successfully, but these errors were encountered: