File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,10 @@ export default class UploadHttpLink extends ApolloLink {
134134 "" ,
135135 ) ;
136136
137+ /**
138+ * URI for the GraphQL request.
139+ * @type {string }
140+ */
137141 let uri = selectURI ( operation , fetchUri ) ;
138142
139143 if ( files . size ) {
@@ -179,11 +183,16 @@ export default class UploadHttpLink extends ApolloLink {
179183 options . method = "GET" ;
180184
181185 if ( options . method === "GET" ) {
182- const { newURI, parseError } = rewriteURIForGET ( uri , body ) ;
186+ const result =
187+ /** @type {{ newURI: string } | { parseError: unknown } } */ (
188+ // The return type is incorrect; `newURI` and `parseError`
189+ // will never both be present.
190+ rewriteURIForGET ( uri , body )
191+ ) ;
183192
184- if ( parseError ) throw parseError ;
193+ if ( " parseError" in result ) throw result . parseError ;
185194
186- uri = newURI ;
195+ uri = result . newURI ;
187196 } else options . body = JSON . stringify ( clone ) ;
188197 }
189198
Original file line number Diff line number Diff line change 3030### Patch
3131
3232- Avoid the deprecated Apollo Link HTTP utility function ` createSignalIfSupported ` .
33- - Moved all the upload terminating Apollo Link request handler code into a single constructed ` Observer ` that’s returned regardless of errors.
33+ - Improved the upload terminating Apollo Link request handler code:
34+ - Moved all of it into a single constructed ` Observer ` that’s returned regardless of errors.
35+ - More type safe.
3436- Updated the package scripts:
3537 - Reordered and renamed scripts.
3638 - Replaced ` npm run ` with ` node --run ` .
You can’t perform that action at this time.
0 commit comments