-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
TypeScript rewrite #73
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
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
8cc0433
Update to Babel 7
denisw 9432c6b
Remove unused @babel/plugin-external-helpers
denisw 1c0c74e
Add Babel Typescript preset and port isPlainObject
denisw 027b870
Port createAction() to TypeScript
denisw 86fd7b0
Port configureStore() to TypeScript
denisw 0b22aaa
Fix Rollup configuration
denisw dfc2b68
Fix type errors in serializableStateInvariantMiddleware.test.ts
denisw 4caa7a3
Port createReducer() to TypeScript
denisw 898a586
Port createSlice() to TypeScript
denisw 59a4d44
Port index.js to TS and add index.d.ts
denisw 81ceb20
Add some typings-tester tests
denisw a9225a5
Add "target" to tsconfig.json
denisw 39e69e3
Use `T extends string` instaead of `string` as action type
denisw 26bb3b2
Remove unneeded extension from Rollup input path
denisw f1ca437
Remove unneeded type parameter
denisw 50c2ed8
Avoid a type cast in createReducer()
denisw 64c703c
Type `isPlainObject` argument as `unknown`
denisw cac9df1
Make findNonSerializableValue() typing more precise
denisw 8c55580
Remove redundant "lib" in tsconfig.json
denisw f1bfbef
Enable "esModuleInterop" in tsconfig.json
denisw 3933c9a
Update typings-tester tsconfig.json
denisw da97831
Fix configureStore() state type inference edge case
denisw 7b0502d
Fix configureStore() state inference without extra type
denisw 1c21c86
Introduce EnhancedStore type for thunk dispatch
denisw b23997a
Update formatting commands
markerikson 88bf6b9
Reformat, again
markerikson b38b2f7
Package lock random changes
markerikson a680049
Conditionally import immutable-state-invariant middleware
markerikson db169a4
Make createReducer() return Reducer<Immutable<S>, A>
denisw 57a9231
Merge branch 'master' into typescript
denisw fcf015b
Revert createReducer() type change
denisw 9fa7442
0.4.0-0
markerikson 82ecf27
Run TypeScript compiler in `prepare`
denisw c48a52d
Configure ESLint for TypeScript
denisw e449c8a
Generate TypeScript declaration files in dist/
denisw d44e834
Revert "Generate TypeScript declaration files in dist/"
denisw e3d7337
Publish src/ for TypeScript typings
denisw 497babf
0.4.0-1
markerikson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"modules": false | ||
} | ||
] | ||
], | ||
"env": { | ||
"development": { | ||
"plugins": ["external-helpers"] | ||
}, | ||
"test": { | ||
"plugins": ["transform-es2015-modules-commonjs"] | ||
} | ||
} | ||
"presets": ["@babel/preset-env", "@babel/preset-typescript"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
module.exports = { | ||
extends: 'react-app', | ||
parser: 'typescript-eslint-parser', | ||
|
||
rules: { | ||
'jsx-a11y/href-no-hash': 'off' | ||
'jsx-a11y/href-no-hash': 'off', | ||
// Taken care of by TypeScript's `noUnusedLocals` / `noUnusedParameters` | ||
'no-unused-vars': 'off' | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,46 @@ | ||
# Redux Starter Kit | ||
|
||
[](https://travis-ci.org/reduxjs/redux-starter-kit) | ||
[](https://www.npmjs.com/package/redux-starter-kit) | ||
[](https://www.npmjs.com/package/redux-starter-kit) | ||
|
||
**A simple set of tools to make using Redux easier** | ||
|
||
`npm install redux-starter-kit` | ||
|
||
(Special thanks to Github user @shotak for donating to the package name.) | ||
|
||
### Purpose | ||
|
||
The `redux-starter-kit` package is intended to help address three common complaints about Redux: | ||
|
||
- "Configuring a Redux store is too complicated" | ||
- "I have to add a lot of packages to get Redux to do anything useful" | ||
- "Redux requires too much boilerplate code" | ||
|
||
We can't solve every use case, but in the spirit of [`create-react-app`](https://github.com/facebook/create-react-app) and [`apollo-boost`](https://dev-blog.apollodata.com/zero-config-graphql-state-management-27b1f1b3c2c3), we can try to provide some tools that abstract over the setup process and handle the most common use cases, as well as include some useful utilities that will let the user simplify their application code. | ||
|
||
This package is _not_ intended to solve every possible complaint about Redux, and is deliberately limited in scope. It does _not_ address concepts like "reusable encapsulated Redux modules", data fetching, folder or file structures, managing entity relationships in the store, and so on. | ||
|
||
### What's Included | ||
|
||
`redux-starter-kit` includes: | ||
|
||
- A `configureStore()` function with simplified configuration options. It can automatically combine your slice reducers, adds whatever Redux middleware you supply, includes `redux-thunk` by default, and enables use of the Redux DevTools Extension. | ||
- A `createReducer()` utility that lets you supply a lookup table of action types to case reducer functions, rather than writing switch statements. In addition, it automatically uses the [`immer` library](https://github.com/mweststrate/immer) to let you write simpler immutable updates with normal mutative code, like `state.todos[3].completed = true`. | ||
- A `createAction()` utility that returns an action creator function for the given action type string. The function itself has `toString()` defined, so that it can be used in place of the type constant. | ||
- A `createSlice()` function that accepts a set of reducer functions, a slice name, and an initial state value, and automatically generates corresponding action creators, types, and simple selector functions. | ||
- An improved version of the widely used `createSelector` utility for creating memoized selector functions, which can accept string keypaths as "input selectors" (re-exported from the [`selectorator` library](https://github.com/planttheidea/selectorator)). | ||
|
||
## Documentation | ||
|
||
The `redux-starter-kit` docs are now published at **https://redux-starter-kit.js.org**. | ||
|
||
We're currently expanding and rewriting our docs content - check back soon for more updates! | ||
# Redux Starter Kit | ||
|
||
[](https://travis-ci.org/reduxjs/redux-starter-kit) | ||
|
||
[](https://www.npmjs.com/package/redux-starter-kit) | ||
|
||
**A simple set of tools to make using Redux easier** | ||
|
||
`npm install redux-starter-kit` | ||
|
||
(Special thanks to Github user @shotak for dona | ||
|
||
**A simple set of tools to make using Redux easier** | ||
|
||
`npm install redux-starter-kit` | ||
|
||
(Special thanks to Github user @shotak for donating to the package name.) | ||
|
||
### Purpose | ||
|
||
The `redux-starter-kit` package is intended to help address three common complaints about Redux: | ||
|
||
- "Configuring a Redux store is too complicated" | ||
- "I have to add a lot of packages to get Redux to do anything useful" | ||
- "Redux requires too much boilerplate code" | ||
|
||
We can't solve every use case, but in the spirit of le complaint about Redux, and is deliberately limited in scope. It and _not_ address concepts like "reusable encapsulated Redux modules", data fetching, folder or file s, we can try to provide some tools that abstract over the setup process and handle the most common use cases, as well as include some useful utilities that will let the user simplify their application code. | ||
|
||
This package is _not_ intended to solve every possible complaint about Redux, and is deliberately limited in scope. It does _not_ address concepts like "reusable encapsulated Redux modules", data fetching, folder or file structures, managing entity relationships in the store, and so on. | ||
|
||
### What's Included | ||
|
||
`redux-starter-kit` includes: | ||
|
||
- A `configureStore()` function with simplified configuration options. It can automatically combine your slice reducers, adds whatever Redux middleware you supply, includes `redux-thunk` by default, and enables use of the Redux DevTools Extension. | ||
- A `createReducer()` utility that lets you supply a lookup table of action types to case reducer functions, rather than writing switch statements. In addition, it automatically uses the e selector functions. | ||
- An improved version of the wid to let you write simpler immutable updates with normal mutative code, like `state.todos[3].completed = true`. | ||
- A `createAction()` utility that returns an action creator function for the given action type string. The function itself has `toString()` defined, so that it can be used in place of the type constant. | ||
- A `createSlice()` function that accepts a set of reducer functions, a slice name, and an initial state value, and automatically generates corresponding action creators, types, and simple selector functions. | ||
- An improved version of the widely used `createSelector` utility for creating memoized selector functions, which can accept string keypaths as "input selectors" (re-exported from the n for more updates!). | ||
|
||
## Documentation | ||
|
||
The `redux-starter-kit` docs are now published at **tent - check back soon for more **. | ||
|
||
We're currently expanding and rewriting our docs content - check back soon for more updates! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export { default as createNextState } from 'immer' | ||
export { | ||
Action, | ||
ActionCreator, | ||
AnyAction, | ||
Middleware, | ||
Reducer, | ||
Store, | ||
StoreEnhancer | ||
} from 'redux' | ||
export { default as createSelector } from 'selectorator' | ||
|
||
export { | ||
configureStore, | ||
ConfigureStoreOptions, | ||
getDefaultMiddleware | ||
} from './src/configureStore' | ||
export { | ||
createAction, | ||
getType, | ||
PayloadAction, | ||
PayloadActionCreator | ||
} from './src/createAction' | ||
export { createReducer } from './src/createReducer' | ||
export { createSlice, CreateSliceOptions, Slice } from './src/createSlice' | ||
export { | ||
default as createSerializableStateInvariantMiddleware, | ||
isPlain | ||
} from './src/serializableStateInvariantMiddleware' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.