chore(deps): update dependency @types/node to v16 (#5170)
* Update Node types to 16 * Update Express core types Fixes a number of conflicts it has with Node 16. * Fix websocket router types It seems req was `any` before so now we have to handle the types. Also it seems the socket is of type `stream.Duplex`, not `net.Socket`. The ws types had to be updated to support the new type. Unfortunately Code still uses the old type so cast for now. In the web socket router just use a cast for the extra properties we add. We could add the types to the Express namespace but I am not sure we really want these commonly accessible so keep with the casts for now. Likely we should use Express's `locals` or something instead. * Add missing return Not sure why it only just now started complaining though. Co-authored-by: Asher <ash@coder.com>
This commit is contained in:
4
typings/pluginapi.d.ts
vendored
4
typings/pluginapi.d.ts
vendored
@ -5,7 +5,7 @@ import { field, Level, Logger } from "@coder/logger"
|
||||
import * as express from "express"
|
||||
import * as expressCore from "express-serve-static-core"
|
||||
import ProxyServer from "http-proxy"
|
||||
import * as net from "net"
|
||||
import * as stream from "stream"
|
||||
import Websocket from "ws"
|
||||
|
||||
/**
|
||||
@ -97,7 +97,7 @@ export declare class HttpError extends Error {
|
||||
}
|
||||
|
||||
export interface WebsocketRequest extends express.Request {
|
||||
ws: net.Socket
|
||||
ws: stream.Duplex
|
||||
head: Buffer
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user