1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-28 21:25:25 +00:00

Add type alias for required modules

This commit is contained in:
Asher 2021-02-09 12:55:32 -06:00
parent 3226d50747
commit 2879bd4c22
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A

View File

@ -12,13 +12,15 @@ import * as util from "./util"
import { Router as WsRouter, WebsocketRouter, wss } from "./wsRouter"
const fsp = fs.promises
// Represents a required module which could be anything.
type Module = any
/**
* Inject code-server when `require`d. This is required because the API provides
* more than just types so these need to be provided at run-time.
*/
const originalLoad = require("module")._load
// eslint-disable-next-line @typescript-eslint/no-explicit-any
require("module")._load = function (request: string, parent: object, isMain: boolean): any {
require("module")._load = function (request: string, parent: object, isMain: boolean): Module {
if (request === "code-server") {
return {
express,