You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classIncomingMessageextendsNodeEventEmitter{// Docs: http://electronjs.org/docs/api/incoming-message/** * Emitted when a request has been canceled during an ongoing HTTP transaction. */on(event: 'aborted',listener: Function): this;// …// more events// …removeListener(event: 'error',listener: Function): this;headers: Record<string,string[]>;httpVersion: string;httpVersionMajor: number;httpVersionMinor: number;statusCode: number;statusMessage: string;}
So working code like this fails to type check:
import{app,net}from"electron";importgetStreamfrom"get-stream";app.on("ready",()=>{constrequest=net.request({url: "https://example.com"});request.on("response",asyncresponse=>{if(true){// error TS2345: Argument of type 'IncomingMessage' is not assignable to parameter of type 'Stream'.console.log(awaitgetStream(response));}else{// error TS2495: Type 'IncomingMessage' is not an array type or a string type.forawait(constchunkofresponse){console.log(chunk.toString());}}});request.end();});
The text was updated successfully, but these errors were encountered:
The confusing part is that the docs stands that "IncomingMessage implements the Readable Stream...". So we can expect that the stream is usable like any other ones.
(Feel free to redirect me if this bug should be reported elsewhere.)
The definition of
IncomingMessage
(generated from https://github.com/electron/electron/releases/download/v9.1.0/electron-api.json) fails to reflect the documentation’s guarantee that “IncomingMessage
implements the Readable Stream interface”:So working code like this fails to type check:
The text was updated successfully, but these errors were encountered: