2

I recently saw this syntax here

export interface ActionReducer<T, V extends Action = Action> {
  (state: T | undefined, action: V): T;
}

I am confused about the syntax <T,V extends Action = Action>

I could not find documentation for this syntax in typescript . Can anyone point me there . It looks like a new syntax as my build is not able to recognize it and gives me this error :

node_modules/@ngrx/store/src/models.d.ts:6:52: ',' expected.

1 Answer 1

2

Generic Parameter Defaults

Checked all versions one by one and figured out this is added in version 2.3 It specifies the default type of V . so V can be either a class which extends Action or if not mentioned will be of type Action.

Doc

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.