api-fetch: Type the rest of the package#30161
Conversation
|
Size Change: +370 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
09e6e5f to
8292d0d
Compare
| } ); | ||
| return ( | ||
| window | ||
| // @ts-ignore |
There was a problem hiding this comment.
Were we going to type this one, too?
There was a problem hiding this comment.
No, I wasn't sure where these came from or how to type them effectively without having to declare the types for all the things that TS is doing a good job of inferring. How does the nonceMiddleware end up on apiFetch?
There was a problem hiding this comment.
I see. Well, this is a mess 😉 Should it have been a part of the nonce middleware instead? It's definitely something we can fix in another PR anyway.
There was a problem hiding this comment.
Just saw this. nonceMiddleware and nonceEndpoint are being used in Core:
It definitely can use some improvements though 😅 .
| "declarationDir": "build-types" | ||
| }, | ||
| "references": [ | ||
| { "path": "../i18n" }, |
tyxla
left a comment
There was a problem hiding this comment.
I've left some nitty suggestions and comments, but I believe this looks great already ❤️
| } ); | ||
| return ( | ||
| window | ||
| // @ts-ignore |
There was a problem hiding this comment.
I see. Well, this is a mess 😉 Should it have been a part of the nonce middleware instead? It's definitely something we can fix in another PR anyway.
* api-fetch: Type the rest of the package * Update CHANGELOG * Undo spread operator * Fall back to window.location * Use location.href instead of toString and fix comments
|
I cherry-picked this PR to the Gutenberg plugin 10.3 release. |
Description
This depends on #30150. It types the rest of
api-fetch.Unfortunately because
fetch-all-middlewaredepends onindex.jsit's not possible to do them separately. Luckily there are very few runtime changes in this PR (only two really).How has this been tested?
Type checks and unit tests pass
Types of changes
New feature! Publicly exposed type definitions for the package 🎉
Checklist: