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/**/thingand/api/test/bob/thingthen 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.createis called with a baseURL, the result is not strongly typed but just a normal external$fetchFurther enhancements needed:
📝 Checklist