Make router decorators gentle towards types#1470
Closed
antonagestam wants to merge 2 commits intoKludex:masterfrom
Closed
Make router decorators gentle towards types#1470antonagestam wants to merge 2 commits intoKludex:masterfrom
antonagestam wants to merge 2 commits intoKludex:masterfrom
Conversation
Contributor
|
One the one hand I think this is a pretty reasonable typing improvement. |
Owner
|
I think we should be strong on decisions: if we want to remove it at some point, let's deprecate it first... I really want this, but if we don't want to estimulate the usage of those decorators, to me it doesn't make sense to make it "more correct" type wise. In any case, I'll be closing this PR just because of the in-code comment we have, and because I'm trying to reduce the amount of stale PRs we have. Thanks for the PR @antonagestam , and sorry for taking long to take a decision here! |
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.
What does this do? These decorators currently destroy the signatures of the functions they're applied to. We remedy this by using a typevar, which makes the signature of the decorators say the equivalent of "I take any callable, and I will return the exact type that I'm given".
With this example:
The current behavior is:
But with this PR applied: