Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing @types/stream-http ? #122

Open
leolivier opened this issue Jun 19, 2021 · 1 comment
Open

missing @types/stream-http ? #122

leolivier opened this issue Jun 19, 2021 · 1 comment

Comments

@leolivier
Copy link

leolivier commented Jun 19, 2021

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 ?

@faeb187
Copy link

faeb187 commented Mar 17, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants