-
Notifications
You must be signed in to change notification settings - Fork 514
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
feat: generate InternalFetch signature #1532
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1532 +/- ##
==========================================
+ Coverage 76.49% 76.76% +0.27%
==========================================
Files 73 73
Lines 7580 7671 +91
Branches 751 768 +17
==========================================
+ Hits 5798 5889 +91
Misses 1781 1781
Partials 1 1
|
Will this be possible in the future with the function overloading approach? |
Will it be possible with the way it is implemented in this PR to augment the OpenAPI documentation #1162? |
This PR has been outstanding as a draft for a year now, are there any updates you can share? |
This is taking longer than expected because we are working on a better standard ecosystem-wise and testable solution. I have created a tracker issue: #2758 (closing this one mainly for triage, let's keep track via issue) |
π Linked issue
β Type of change
π Description
This PR reworks how our internal API routes are typed. This aims to do more of the work at build time rather than asking typescript to do it. Testing in our fixture showed type-checking speed improvement of up of 45%.
Note: The reason that this is so much faster is that we use function overloads, which means that we do not yet support all the matching patterns that our existing type-only algorithm does. It matches only one result so if you have multiple overlapping patterns, like
/api/test/**/thing
and/api/test/bob/thing
then if you request$fetch('/api/test/${someUnknownString}')
then we won't be able to give a union of the two return times as before.It adds the following type-safety functionalities:
$fetch.create
is called with a baseURL, the result is not strongly typed but just a normal external$fetch
Further enhancements needed:
π Checklist