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

issue with @types/ws? #25890

Closed
thepixelmonk opened this issue May 19, 2018 · 8 comments
Closed

issue with @types/ws? #25890

thepixelmonk opened this issue May 19, 2018 · 8 comments

Comments

@thepixelmonk
Copy link

node_modules/@types/ws/index.d.ts(179,24): error TS2694: Namespace '"net"' has no exported member 'AddressInfo'.

any ideas?

@peterkelly
Copy link

peterkelly commented May 21, 2018

I found that to the latest type definitions for node fixed this problem:

npm install @types/node

@thepixelmonk
Copy link
Author

yup! thx.

@austinried
Copy link
Contributor

austinried commented Jun 1, 2018

This means that these types are only compatible with @types/node@10, which is what currently gets installed when you use @types/node. I can find no information on ws that says it is not compatible with node <10, why was a dependency on node 10 taken for the types?

Closest thing I can find is that version 5.0.0 of ws dropped support for node < 4.5.0 (in this release: https://github.com/websockets/ws/releases/tag/5.0.0), so these type definitions for 5.x should be working with everything above that.

@Griffork
Copy link

Griffork commented Jun 1, 2018

I'm trying to use these types on node @6.12 and they're not working.

@kyledetella
Copy link

I just downgraded @types/node from ^10.x to 9.3.0 (the version of Node I am pinned to) to mitigate this issue (which is actually not an Angular issue, btw) and am now experiencing this issue.

@Griffork
Copy link

Griffork commented Jun 2, 2018

@kyledetella a pull request has been submitted and should be completed in the next week or so.

In the meantime you can add the following code to an empty .d.ts file in your project to get it to compile

declare module 'net' {
    export interface AddressInfo {} 
} 

Writing on phone - sorry for mistakes.

@kyledetella
Copy link

Thanks @Griffork. That did the trick!

@Griffork
Copy link

Griffork commented Jun 6, 2018

Looks like the fix has been merged. I haven't tested it yet though.

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

5 participants