stream-http
stream-http copied to clipboard
missing @types/stream-http ?
Hi, disclaimer: not an expert in JS ! I can't find anywhere the typescript declarations of stream-http. I used the @types/node for getting the definitions of standard types like IncomingMessage but I'd like to be able to write
import { streamHttp } from "stream-http";
and currently I'm forced to write
const streamHttp = require("stream-http");
and the type of streamHttp is any...
I tried just adding a module declaration like this in my own shims-vue.d.ts:
declare module "stream-http";
but it does not provide any typing.
Is there a way to have a true TS declaration for that?
EDIT: I saw the e.g. the request or get functions are described at the same place as IncomingMessage but how to "map" the stream-http module on the http module ?
you can import everyting (not recommended) like this:
import streamHttp from "stream-http
or simply what you need, e.g. I'm using the STATUS_CODES in my react app so I'm importing:
import { STATUS_CODES } from "stream-http";
and yes, you have to declare the module as there is are is no types package at the moment it seems.
Update: @leolivier yeah, I get your point, maybe you are the one to provide the types package for us hehe 🙌 I'm a bit in a hurry and just thankful for the library, ran into the breaking change using "http" core module.