refactor: add types for mutation errors#303
Draft
michael-small wants to merge 3 commits into
Draft
Conversation
michael-small
commented
May 17, 2026
| onSuccess: (response) => { | ||
| console.log('Counter sent to server:', response); | ||
| }, | ||
| // TODO - In the current state, parsing for the error does not narrow unless either |
Collaborator
Author
There was a problem hiding this comment.
Provided this is the behavior we think makes sense, then I just need to add a test at this point. Thoughts?
Collaborator
Author
There was a problem hiding this comment.
@rainerhahnekamp we spoke about this privately a few months back, and you proposed a flag, but I think this solution is sufficient and IMO better. Wondering before I just write up some tests/docs on this.
Sound good?
Collaborator
There was a problem hiding this comment.
Yes that definitely makes sense
rainerhahnekamp
requested changes
May 30, 2026
| import { Signal } from '@angular/core'; | ||
|
|
||
| export type MutationResult<Result> = | ||
| export type MutationResult<Result, Err> = |
Collaborator
There was a problem hiding this comment.
if that type is public api we need a default value for Err as well. Otherwise it would be breaking
|
|
||
| export type Mutation<Parameter, Result> = { | ||
| (params: Parameter): Promise<MutationResult<Result>>; | ||
| export type Mutation<Parameter, Result, Err> = { |
Collaborator
There was a problem hiding this comment.
also here default type if part of the public API
1fceb9b to
44c4da6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #285