I'm pretty newbie with rxjs, can you please tell what's wrong with below?
interface IHTTP {
req: IncomingMessage;
res: ServerResponse;
handler?: Promise<any>;
}
server = http.createServer();
let request$: Observable<any>;
request$ = fromEvent(server, 'request').pipe(
map(([req, res]: [IncomingMessage, ServerResponse]): IHTTP => {
return { req, res } as IHTTP;
}
)
);
Compile error:
TS2345: Argument of type 'OperatorFunction<[IncomingMessage, ServerResponse], IHTTP>' is not assignable to parameter of type 'OperatorFunction<unknown, IHTTP>'. ??Type 'unknown' is not assignable to type '[IncomingMessage, ServerResponse]'.
question from:
https://stackoverflow.com/questions/65640917/rxjs-http-server-with-typescript-compile-errors 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…