-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
props doesn't accept HttpErrorResponse #2892
Comments
@dev054 export abstract class HttpResponseBase {
/**
* Type of the response, narrowed to either the full response or the header.
*/
readonly type: HttpEventType.Response | HttpEventType.ResponseHeader;
} However, Try this: const a = createAction('a', props<{ error: HttpErrorResponse }>()); |
Thanks @markostanimirovic 👍 I wonder if we could make it clearer in the docs, e.g. don't do this (code example) and do with a prop name instead (code example). |
Fyi, I'm going to steal this and going to create a lint rule for this add eslint-plugin-ngrx. |
@dev054 do you think it would be more clear if we would change the error message? |
Does this succinctly describe the problem?
The docsite could also note the list of illegal generic arguments for |
@david-shortman you can add a note to the docs if you still want to do that. |
I think the other problem is that the error shows up in a list of messages about overloads. |
Closes #2892 BREAKING CHANGES: Types for props outside an action creator is more strictly checked BEFORE: Usage of `props` outside of an action creator with invalid types was allowed AFTER: Usage of `props` outside of an action creator now breaks for invalid types
Minimal reproduction of the bug/regression with instructions:
I want to pass the HttpError through an action and so I do the following:
... however it doesn't compile:
Expected behavior:
props
acceptHttpErrorResponse
.Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):
Ngrx 10, Angular 11.
Other information:
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
The text was updated successfully, but these errors were encountered: