Skip to content
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

[RFR] Add types to side effects #2535

Merged
merged 2 commits into from
Nov 21, 2018
Merged

[RFR] Add types to side effects #2535

merged 2 commits into from
Nov 21, 2018

Conversation

fzaninotto
Copy link
Member

Part of the ongoing effort to add TypeScript support to ra-core

@fzaninotto fzaninotto added this to the v2.4.3 milestone Nov 14, 2018
} from '../../../../actions/listActions';
import { CRUD_DELETE_OPTIMISTIC } from '../../../../actions/dataActions';

const initialState = [];

export default (previousState = initialState, action) => {
type State = any[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think every reducer should probably export its state definition and we should make a complete state definition by composing all of them in the root types.ts file

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that combineReducer does it. Let's wait until the main reducer is migrated to TS to see.

Copy link
Contributor

@djhi djhi Nov 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, yes, but that won't allow our users to have a typed state in their mapStateToDispatch functions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll export the states in a future PR

@djhi djhi merged commit 29fc75e into master Nov 21, 2018
@djhi djhi deleted the typescript-side-effects branch November 21, 2018 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants