Prevent then from being called after end#66
Open
jleider wants to merge 2 commits into
Open
Conversation
| **Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a | ||
| high state of flux, you're at risk of it changing without notice. | ||
|
|
||
| # 0.6.0 |
Collaborator
There was a problem hiding this comment.
@jleider we will bump the package's version and add the entry in the changelog just before publish the v0.6.0
StefanoMagrassi
requested changes
Jun 15, 2023
| } | ||
|
|
||
| end(): MatchEnd<A> { | ||
| return this.then(new Match( |
Collaborator
There was a problem hiding this comment.
@jleider this will return a Match<A & {}> and raises this TS error:
Type 'Match<A & {}>' is not assignable to type 'MatchEnd<A>'
| * @since 0.4.0 | ||
| */ | ||
| export const end: Match<{}> = new Match( | ||
| export const end: MatchEnd<{}> = new MatchEnd( |
Collaborator
There was a problem hiding this comment.
@jleider this implementation will break existing code which uses end like that:
.then(end)
// Throws:
// Argument of type 'MatchEnd<{}>' is not assignable to parameter of type 'Match<{}> & Match<Record<never, never>>'.ts(2345)Even if the package's version is below 1.0.0, the library has been published from quite a lot by now and we have to be as careful as possible
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.
Calling
thenafterendwith additional routing parameters the router leads to some unexpected runtime behavior. This change prevents the possibility ofthenbeing chained after anend.The main difference here is the addition of a
MatchEnd<A>type which does not contain animaporthenfunction. If anyone has a better idea of what to name this type or another approach I am happy to entertain alternative ideas.One thing to note, this is a breaking change so I have bumped the version to
0.6.0which I believe due to semantic versioning is acceptable due to this package being below1.0.0.