File tree 3 files changed +21
-1
lines changed
eventstream-serde-browser/src
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @smithy/eventstream-serde-browser " : patch
3
+ " @smithy/util-stream " : patch
4
+ ---
5
+
6
+ avoid compilation of global ReadableStream with type parameter
Original file line number Diff line number Diff line change @@ -68,5 +68,11 @@ export class EventStreamMarshaller {
68
68
}
69
69
}
70
70
71
+ /**
72
+ * @internal
73
+ * Warning: do not export this without aliasing the reference to
74
+ * global ReadableStream.
75
+ * @see https://github.com/smithy-lang/smithy-typescript/issues/1341.
76
+ */
71
77
const isReadableStream = ( body : any ) : body is ReadableStream =>
72
78
typeof ReadableStream === "function" && body instanceof ReadableStream ;
Original file line number Diff line number Diff line change 1
1
/**
2
2
* @internal
3
+ * Alias prevents compiler from turning
4
+ * ReadableStream into ReadableStream<any>, which is incompatible
5
+ * with the NodeJS.ReadableStream global type.
3
6
*/
4
- export const isReadableStream = ( stream : unknown ) : stream is ReadableStream =>
7
+ type ReadableStreamType = ReadableStream ;
8
+
9
+ /**
10
+ * @internal
11
+ */
12
+ export const isReadableStream = ( stream : unknown ) : stream is ReadableStreamType =>
5
13
typeof ReadableStream === "function" &&
6
14
( stream ?. constructor ?. name === ReadableStream . name || stream instanceof ReadableStream ) ;
You can’t perform that action at this time.
0 commit comments