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

Use string literal type for CALL_HISTORY_METHOD #147

Merged
merged 1 commit into from
Oct 7, 2018

Conversation

maxhawkins
Copy link
Contributor

Use the string literal '@@router/CALL_HISTORY_METHOD' as the type for CALL_HISTORY_METHOD.

I have a type Action = LocationChangeAction | RouterAction and would like to differentiate between types of actions using a switch statement like this:

switch (action.type) {
case CALL_HISTORY_METHOD:
  // x
case LOCATION_CHANGE:
  // y
}

The type needs to be a string literal rather than a generic string type for this to work.

Use the string literal `'@@router/CALL_HISTORY_METHOD'` as the type for `CALL_HISTORY_METHOD`.

I have a `type Action = LocationChangeAction | RouterAction` and would like to differentiate between types of actions using a switch statement like this:

```
switch (action.type) {
}
```
@supasate
Copy link
Owner

supasate commented Oct 7, 2018

LGTM. Thanks for your contribution!

@supasate supasate merged commit 7178a65 into supasate:master Oct 7, 2018
@supasate supasate mentioned this pull request Oct 7, 2018
@dimitriirybakov
Copy link
Contributor

@supasate could you publish it, please?

@supasate
Copy link
Owner

supasate commented Nov 3, 2018

Released in 5.0.0! (Beware of the breaking change. Please see the release note https://github.com/supasate/connected-react-router/releases/tag/v5.0.0)

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.

3 participants