I have a WritableStream that expects objects of the shape { test1: string; test2: string }
.
I have a ReadableStream that emits objects of the shape { test1: string }
.
Piping the readable stream into the writable stream will cause problems, as the objects emitted by the readable stream are lacking the test2
property.
However, the statement new ReadableStream<{ test1: string }>().pipeTo(new WritableStream<{ test1: string; test2: string }>)
does not cause any type errors.
Why does the statement not emit any type errors? Is there a way how I can define my WritableStream so that it causes type errors when incompatible data is piped into it?