Description
Do you want to request a feature or report a bug?
Bug -- Sort of... it's an incomplete comment in index.d.ts
What is the current behavior?
The comment above AnyAction
is incomplete. See here:
/**
* An Action type which accepts any other properties.
* This is mainly for the use of the `Reducer` type.
* This is not part of `Action` itself to prevent users who are extending `Action.
*/
export interface AnyAction extends Action {
// Allows any extra properties to be defined in an action.
[extraProps: string]: any
}
This sentence never finishes, failing to explain the reasoning for the AnyAction type to exist.
This is not part of `Action` itself to prevent users who are extending `Action.
...???
What is the expected behavior?
This comment should finish its sentence and be more clear.
I can submit a PR once told what this is supposed to say, but I'm not quite sure just by looking at it... It's obvious the rest of the sentence was not included, but not obvious what it was going to say.
However, honestly, I'm not quite sure having AnyAction
makes much sense here. It appears to only be adding an index signature to the base Action
type, but I think we actually want that index signature on Action
too, as we should be able to do things like someAction['type']
.... and, if that's the case, what does AnyAction
even do for us here? TypeScript does not enforce exactly matching properties in object types. It only requires us to meet the requirements of the interface/type, ignoring any extra properties. So, we can still include extra properties with the Action
type.
This leaves me wondering... do we even need this AnyAction
type at all?