ERROR in @types/ws trying to update from angular 12 to angular 13
Asked Answered
U

3

11

I have updated my project from angular 12 to angular 13 and I'm facing this error:

Error: node_modules/@types/ws/index.d.ts:328:18 - error TS2315: Type 'Server' is not generic.

328         server?: HTTPServer<V> | HTTPSServer<V> | undefined;
                     ~~~~~~~~~~~~~


Error: node_modules/@types/ws/index.d.ts:328:34 - error TS2315: Type 'Server' is not generic.

328         server?: HTTPServer<V> | HTTPSServer<V> | undefined;
                                     ~~~~~~~~~~~~~~

I tried installing npm i @types/ws with no success.

Unarmed answered 12/6, 2023 at 11:7 Comment(0)
P
35

Solution: npm install -f @types/[email protected]

Phantasmal answered 13/6, 2023 at 15:13 Comment(0)
U
2

I just had to update "@types/node". The problematic version I had installed was v12

Undecagon answered 8/1 at 17:0 Comment(0)
P
1

Upgrading @types/ws to 8.5.4 as mentioned above was strangely not the fix - I already had that version.
However, this tip by @vidalsasoon was more helpful, even though I was using Node 16 by now, I still had @types/node version 12 (I guess it just worked) - I needed to update to 18 since I'm now on Node 18:

npm i @types/node@18

This fixed the problem causing this error:

Error: node_modules/@types/ws/index.d.ts:328:18 - error TS2315: Type 'Server' is not generic.

I also upgraded TypeScript to the latest 4.x.y version, per the Angular Update Guide's recommendation:

npm i typescript@^4

I'll hold off on TS 5 until Angular upgrade guide suggests it for the next version.

Paulapauldron answered 20/3 at 0:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.