-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Basic Typescript typings #70
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
Also included is a typings-tester integration with some initial tests, plus the configuration needed to include `index.d.ts` in the release distribution.
Deploy preview for redux-starter-kit-docs ready! Built with commit b84231f https://deploy-preview-70--redux-starter-kit-docs.netlify.com |
The generated action creator is now typed such that it returns a PayloadAction when called with a payload argument, and a payload-less Action when called without arguments.
This looks interesting. But, how much effort would it be to either push #38 forward, or just convert the codebase to TS from scratch? |
I took the definition file approach because it seemed less intrusive, and more it line with what has been done for core Redux. But I'd also be happy to continue the TypeScript rewrite work started in #38 instead. From the perspective of a redux-starter-kit user, there is no perceivable difference; it is a pure manner of what is preferable from a maintainers' point of view. What do you think? Regarding |
If we're gonna do TS stuff, I'd rather just go ahead and rewrite it in TS now, before we make any further changes. @Dudeonyx actually seems to have done the TS conversion in https://github.com/Dudeonyx/redux-ts-starter-kit to some extent, and just offered to help out: https://www.reddit.com/r/reactjs/comments/ad6cmt/check_out_my_first_serious_npm_package/ . |
Alright! I'm going to pick up the TypeScript rewrite work then. As a first step, I'm going to open a PR with an upgrade to Babel 7 so that we can use |
I opened the Babel 7 PR as #71. Closing this PR. |
* Fix return types for matchers * use action matchers, retype matched types, tests * extract error types for thunk matchers Co-authored-by: Lenz Weber <[email protected]>
This PR is a less ambitious alternative to #38. It is not a rewrite in TypeScript, but simply adds a separate type definition file (
index.d.ts
), similar to how TypeScript support is provided in the core Redux repo. Also like in the case of Redux, the typings come with a set of test TypeScript files run through typings-tester to ensure that the typings work as intended.I am sure that some of the typings could be made even more precise. I'd say, though, that this is a decent first step that we can iterate on later, and it should be definitely better for TypeScript users than not having typings at all.