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

Inconsistent readonly usage #3050

Closed
peterreisz opened this issue Jun 21, 2021 · 1 comment · Fixed by #3069
Closed

Inconsistent readonly usage #3050

peterreisz opened this issue Jun 21, 2021 · 1 comment · Fixed by #3069

Comments

@peterreisz
Copy link
Contributor

Minimal reproduction of the bug/regression with instructions:

Here we have readonly modifier before the ActionCreator[]:

export interface OnReducer<State, Creators extends readonly ActionCreator[]> {
(state: State, action: ActionType<Creators[number]>): State;
}

But here we don't:

export function createReducer<S, A extends Action = Action>(
initialState: S,
...ons: ReducerTypes<S, ActionCreator[]>[]
): ActionReducer<S, A> {

Expected behavior:

Be consistent, use readonly in both places.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

ngrx store version: 12.1.0

Other information:

In my project I have several reducer function extracted to a variable and a linter rule demands that I specify the type for them.
If I want to satisfy the linter, the inconsistent readonly usage results non compiling code.

I would be willing to submit a PR to fix this issue

[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No

@timdeschryver
Copy link
Member

This seems like a reasonable change, feel free to create a Pull Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants