Fix intellisense/completions for partial route parameter objects#880
Open
bakerkretzmar wants to merge 8 commits into2.xfrom
Open
Fix intellisense/completions for partial route parameter objects#880bakerkretzmar wants to merge 8 commits into2.xfrom
bakerkretzmar wants to merge 8 commits into2.xfrom
Conversation
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.
This PR fixes #736, where route parameter names are not suggested/completed inside
route()calls until all the route's required parameters are provided.There are a few different pieces to this:
route(undefined, undefined, ...)overloaded type definition so that's it's defined last. This is enough to make intellisense find the earlier overloads and autocomplete params from them.strictandstrictNullChecksmissing fromtsconfig.jsonor set tofalse), callingroute(undefined, ...)does match the earlier overloads, and incorrectly appears to return aRouteUrlinstead of aRouter. Changing thenameparameters toT & {}fixes this, preventingundefinedfrom matching those params. This is kinda ugly but improves compatibility and I'm confident the tests we have prove it works fine.This PR also finally adds real intellisense/autocompletion tests! We spin up a full TypeScript language service, pass it some fixture code, and assert against what completions it says it will generate.