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

Update index.ts #2081

Merged
merged 1 commit into from
Aug 23, 2019
Merged

Update index.ts #2081

merged 1 commit into from
Aug 23, 2019

Conversation

KamranAsif
Copy link
Contributor

#1691 PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

ActionType is useful for extracting the response type of the new action creators.

Currently, ActionType is only accessible if importing from '@ngrx/store/src/models'.

What is the new behavior?

ActionType can now be imported from @ngrx/store

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

fix(store): Expose ActionType interface from store/src/models.

ActionType is useful for extracting the response type of the new action creators.
@ngrxbot
Copy link
Collaborator

ngrxbot commented Aug 23, 2019

Preview docs changes for dc7061e at https://previews.ngrx.io/pr2081-dc7061e/

Copy link
Member

@alex-okrushko alex-okrushko left a comment

Choose a reason for hiding this comment

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

Thanks Kamran!

@alex-okrushko alex-okrushko merged commit eb5dbb9 into ngrx:master Aug 23, 2019
@SerkanSipahi
Copy link
Contributor

@KamranAsif hi, thank you for your PR! Im interested in an example of:

ActionType is useful for extracting the response type of the new action creators.

Could you show some examples, thank you :)

@KamranAsif
Copy link
Contributor Author

Hey, sure. It basically allows you to avoid extracting an action's properties to an interface.

before:

class MyAction {
  readonly type = '[Test] my action';
  constructor(readonly foo: number, readonly bar: number) {}
}

function handleAction(action: MyAction) {
  return action.foo + action.bar;
}

With action creators:

const myAction = createAction('[Test] my action', props<{foo: number, bar: number}>);

function handleAction(action: ActionType<typeof myAction>) {
  return action.foo + action.bar
}

@KamranAsif KamranAsif deleted the patch-2 branch August 27, 2019 14:30
jordanpowell88 pushed a commit to jordanpowell88/platform that referenced this pull request Nov 14, 2019
fix(store): Expose ActionType interface from store/src/models.

ActionType is useful for extracting the response type of the new action creators.
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.

4 participants