-
Notifications
You must be signed in to change notification settings - Fork 10
Create index.d.ts #7
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
base: master
Are you sure you want to change the base?
Conversation
gkubisa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry it took me so long to review it. Would you mind making some improvements before I merge this PR?
| @@ -0,0 +1,16 @@ | |||
| import { Duplex } from "stream"; | |||
| import WebSocket from 'ws'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@types/ws would need to be added as a dependency to package.json.
| declare class WebSocketJSONStream extends Duplex { | ||
| private _emittedClose; | ||
| private ws; | ||
| constructor(ws: WebSocket); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebSocketJSONStream works with a browser version of WebSocket too, so that should be taken into the account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any ideas on how to address it? I think /// <reference lib="dom" /> should provide WebSocket... Would we then still need import WebSocket from 'ws';?
issue #5
Add The Typescript definitions. @gkubisa