mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Upgrade to typescript 4.3 (#2894)
This commit is contained in:
1 parent
b322d13d47
commit
9f1e262310
13 files changed
+1420
-91
No files matched your search
@@ -36,7 +36,7 @@ jest.mock("fs-extra");
|
||||
jest.mock("../../notifications");
|
||||
|
||||
jest.mock("../../../../common/utils", () => ({
|
||||
...jest.requireActual("../../../../common/utils"),
|
||||
...jest.requireActual<any>("../../../../common/utils"),
|
||||
downloadFile: jest.fn(() => ({
|
||||
promise: Promise.resolve()
|
||||
})),
|
||||
|
||||
@@ -21,6 +21,18 @@
|
||||
|
||||
import { Readable } from "readable-stream";
|
||||
|
||||
type TypeArray = Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array;
|
||||
|
||||
/**
|
||||
* ReadableWebToNodeStream
|
||||
*
|
||||
@@ -29,7 +41,7 @@ import { Readable } from "readable-stream";
|
||||
* Adds read error handler
|
||||
*
|
||||
* */
|
||||
export class ReadableWebToNodeStream extends Readable {
|
||||
export class ReadableWebToNodeStream<T extends TypeArray> extends Readable {
|
||||
|
||||
public bytesRead = 0;
|
||||
public released = false;
|
||||
@@ -38,14 +50,14 @@ export class ReadableWebToNodeStream extends Readable {
|
||||
* Default web API stream reader
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader
|
||||
*/
|
||||
private reader: ReadableStreamReader;
|
||||
private pendingRead: Promise<any>;
|
||||
private reader: ReadableStreamReader<T>;
|
||||
private pendingRead: Promise<ReadableStreamDefaultReadResult<T>>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stream ReadableStream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
|
||||
*/
|
||||
constructor(stream: ReadableStream) {
|
||||
constructor(stream: ReadableStream<T>) {
|
||||
super();
|
||||
this.reader = stream.getReader();
|
||||
}
|
||||
@@ -78,7 +90,7 @@ export class ReadableWebToNodeStream extends Readable {
|
||||
this.bytesRead += data.value.length;
|
||||
this.push(data.value); // Push new data to the queue
|
||||
}
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.push(null); // Signal EOF
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user