Skip to content

Commit dfdf356

Browse files
authored
fix: Typing for WritableStream (#1186)
- Import in a different file and just export it - Use implicit typing to work around the issue - Fixes #803
1 parent 4870171 commit dfdf356

3 files changed

Lines changed: 4 additions & 28 deletions

File tree

package-lock.json

Lines changed: 2 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/iris-grid/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
"prop-types": "^15.7.2",
5050
"react-beautiful-dnd": "^13.1.0",
5151
"react-transition-group": "^4.4.2",
52-
"shortid": "^2.2.16",
53-
"web-streams-polyfill": "^2.1.0"
52+
"shortid": "^2.2.16"
5453
},
5554
"peerDependencies": {
5655
"react": "^17.x",

packages/iris-grid/src/sidebar/TableSaver.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { PureComponent } from 'react';
2-
import { WritableStream as ponyfillWritableStream } from 'web-streams-polyfill/ponyfill';
32
import dh, {
43
Column,
54
DateWrapper,
@@ -10,7 +9,6 @@ import dh, {
109
} from '@deephaven/jsapi-shim';
1110
import Log from '@deephaven/log';
1211
import { GridRange, GridRangeIndex, memoizeClear } from '@deephaven/grid';
13-
1412
import { Formatter, FormatterUtils, TableUtils } from '@deephaven/jsapi-utils';
1513
import {
1614
CancelablePromise,
@@ -97,9 +95,6 @@ export default class TableSaver extends PureComponent<
9795
this.snapshotPending = 0;
9896
this.cancelableSnapshots = [];
9997

100-
// WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead
101-
this.WritableStream = window.WritableStream ?? ponyfillWritableStream;
102-
10398
// Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.
10499
// Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.
105100
// If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.
@@ -175,12 +170,6 @@ export default class TableSaver extends PureComponent<
175170

176171
cancelableSnapshots: (CancelablePromise<unknown> | null)[];
177172

178-
// WritableStream is not supported in Firefox (also IE) yet. use ponyfillWritableStream instead
179-
180-
// TODO: Fix type error
181-
WritableStream = window.WritableStream ?? ponyfillWritableStream;
182-
// WritableStream: typeof window.WritableStream | typeof ponyfillWritableStream;
183-
184173
// Due to an open issue in Chromium, readableStream.cancel() is never called when a user cancel the stream from Chromium's UI and the stream goes on even it's canceled.
185174
// Instead, we monitor the pull() behavior from the readableStream called when the stream wants more data to write.
186175
// If the stream doesn't pull for long enough time, chances are the stream is already canceled, so we stop the stream.
@@ -257,7 +246,7 @@ export default class TableSaver extends PureComponent<
257246
};
258247
}
259248

260-
return new this.WritableStream(streamConfig);
249+
return new WritableStream(streamConfig);
261250
}
262251

263252
startDownload(

0 commit comments

Comments
 (0)