1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

Update dependency typescript to v5.8.2 (#4736)

* Update dependency typescript to v5.8.2

* Improve types

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
renovate[bot]
2025-03-04 14:05:14 +00:00
committed by GitHub
parent 4835ca61ec
commit c1c473e6c6
2 changed files with 7 additions and 7 deletions

View File

@@ -39,9 +39,9 @@ interface TypedResponse<T> extends Response {
json(): Promise<T>;
}
export type ResponseType<T, O extends IHttpOpts> = O extends undefined
? T
: O extends { onlyData: true }
export type ResponseType<T, O extends IHttpOpts> = O extends { json: false }
? string
: O extends { onlyData: true } | undefined
? T
: TypedResponse<T>;
@@ -371,7 +371,7 @@ export class FetchHttpApi<O extends IHttpOpts> {
}
if (this.opts.onlyData) {
return json ? res.json() : res.text();
return (json ? res.json() : res.text()) as ResponseType<T, O>;
}
return res as ResponseType<T, O>;
}