-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Meta PR] Convert to TypeScript #3536
Conversation
* scaffolding for typescript * add jest types so tests will compile * remove rollup-plugin-typescript2, probably don't need it * add missing eslint-import * fix linting errors
* fix replaceReducer type * remove extraneous type * Update the JSDoc so IDEs don't complain. * new test for replaceReducers Co-authored-by: Tim Dorr <timdorr@users.noreply.github.com>
* Fix linter configuration for test files * Add separate ESLint config to test/typescript * Also lint TypeScript files in examples
* fix typescript config for rollup * h/t @timdorr remove need for .rpt2_cache ignore
* convert applyMiddleware.js to typescript * vastly improve the definition of middleware types
Deploy preview for redux-docs ready! Built with commit d8417e8 |
* convert combineReducers to typescript * use idiomatic JS
* fix config * export types * use export from, reorganize * fix stupid eslint rule breakage
* extract store types from index.d.ts * move storeTypes.ts into types/ * Rename storeTypes.ts to store.ts Co-authored-by: Tim Dorr <timdorr@users.noreply.github.com>
* add overloads to compose.ts * add applyMiddleware overload fixes
* fix replaceReducer with a store enhancer * remove erroneous restriction on StateExt * remove the other extension - our store enhancer might add array functionality, for instance * add reasonable defaults for Ext and StateExt * fix state, add a test for non-object-based state * add verification that store extension is also passed to replaceReducer * better fix: set state default based on what base type it is * fix array test * fix typing of StateExt * add mhelmerson example * fix replaceReducer, so that it infers types, fix example test * fix the weird type hacks in the test * add final working example * update based on PR type changes * fix type * update tests to reflect complete examples * merge the changes from index.d.ts into types/store.ts * extend store type * much better approach: only extend the state when we have an extension * fix typing issues not caught before * add link to the place I learned about this
* fully move away from index.d.ts * build types into the types/ directory * remove autogenerated types dir * ignore auto-generated types * better type building, also clean old definitions * use types instead of typings Co-Authored-By: Jed Mao <jedmao@users.noreply.github.com> * Don't build declaration maps
I'm going to hold off #3563 until after this, since it's an enhancement to the types. I think we have everything in place now. Let's see what the CI says... |
CI is happy, but there's still an issue with type duplication and resolution that I fixed in #3564 |
* Defer to rollup TS plugin to build types * index.ts -> redux.js, redux.d.ts * Only output one copy of the types. This also puts them back into the types path. However, I don't know how to have them output as a single file bundle to match our other outputs. * Remove the move Co-authored-by: Tim Dorr <git@timdorr.com>
OK, one last thing I'd like to do is flatten the types to a single bundle. But I don't think that's critical to move on to the next stage: enhancement! Thanks to everyone for your help thus far! |
Very cool. 🎆 One thing though: While I see you are already aware of the "single bundle", I just wanted to chime in on how important that can be - please don't do a release before having the single type bundle: @babel/preset-typescript has severe problems with type re-exports ( babel/babel#8361 or babel/babel-loader#603 among dozens of others) that sometimes make libraries with multiple typings files & re-exports almost impossible to use with a webpack+babel-typescript setup. |
|
This is just a PR tracking our ts-conversion branch so we can have a quick overview of the status of things, commentable code, and a big green merge button to finish things up.
Closes #3500