-
Notifications
You must be signed in to change notification settings - Fork 57
Typescript Typings #9
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
Conversation
Thanks for this!! I was about to tell you that I tried the conversion of the entire lib to typescript in the branch |
- Fixed options type for createSubscriber - Fixed options type for createHook - Fixed onUpdate method type for createContainer
Missing type for |
Hope you don't mind @sandorfr if I've pushed my commit here, it just makes our life easier having one "source of truth". It is still WIP but I've reordered the types so they match Flow (much easier to change/fix stuff if they are almost 1:1) and added the same tests that I did for Flow. Was not able to find a way, given actions Ideas on how we can achieve that? |
@albertogasparin Of course I don't mind, quite the opposite. I'll try to have a look later today. |
@albertogasparin The thunks should look better now. Also you removed the constraint on the shape of Actions when creating a store. which means we would accept anything. I've reintroduced it, let me know if it triggers question |
Great! We are almost there. There are just 2 things left to fix |
@albertogasparin is there a way to disable the flow checks and lint rules for the tsx files :D It's a bit confusing 😭 |
Done. Run |
thanks @albertogasparin that was just esling which had flow rules (confused me) On the inference, I'd like this to work: const inferedStore = createStore({
initialState: {
counter : 0
},
actions: {
increment: (by: number = 1) => ({getState, setState}) =>{
setState({
counter : getState().counter + by
})
},
composite : () => ({actions}) => {
actions.increment(2);
}
}
}); Which currently fails with TS2339:
I'm not sure it's fixable :( I'm afraid we are running in a case related to microsoft/TypeScript#6230 |
add test for full inference on createStore
Speaking of types testing you should consider adding dtslint for that. I have some POC setup in https://github.com./cytrowski/teedux/pull/3/files |
Thanks @cytrowski, updated to use |
Closes #29 |
This adds typescript typings to the package. This would enable typescript support out of the box.
TODO: