refactor(http): fix a strictBindCallApply issue. (#34817)

`String.fromCharCode`'s type signature requires a regular `number[]`.

PR Close #34817
This commit is contained in:
Martin Probst 2020-01-16 19:34:12 +01:00 committed by Matias Niemelä
parent a3b2d6735a
commit 11a4370e15
1 changed files with 6 additions and 2 deletions

View File

@ -57,9 +57,13 @@ export abstract class Body {
if (this._body instanceof ArrayBuffer) {
switch (encodingHint) {
case 'legacy':
return String.fromCharCode.apply(null, new Uint16Array(this._body));
// TODO: Argument of type 'Uint16Array' is not assignable to parameter of type
// 'number[]'.
return String.fromCharCode.apply(null, new Uint16Array(this._body) as any);
case 'iso-8859':
return String.fromCharCode.apply(null, new Uint8Array(this._body));
// TODO: Argument of type 'Uint8Array' is not assignable to parameter of type
// 'number[]'.
return String.fromCharCode.apply(null, new Uint8Array(this._body) as any);
default:
throw new Error(`Invalid value for encodingHint: ${encodingHint}`);
}