From fd0b3a0b8f89c3777a4a65e2ba938f4f9dfd256f Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Thu, 2 Apr 2026 09:49:57 -0700 Subject: [PATCH] noImplicitOverride: enabled override modifier checking Added 'override' keyword to methods that override base class members: - src/level.ts: override open() methods - src/plugin/plugin-remote-worker.ts: override setStorage() methods - src/plugin/runtime/node-fork-worker.ts: override pid getter - src/plugin/runtime/python-worker.ts: override stdout/stderr getters - src/rpc.ts: override cause parameter in RPCResultError - src/runtime.ts: override wss property - src/state.ts: override listenDevice() method --- server/src/level.ts | 4 ++-- server/src/plugin/plugin-remote-worker.ts | 4 ++-- server/src/plugin/runtime/node-fork-worker.ts | 2 +- server/src/plugin/runtime/python-worker.ts | 4 ++-- server/src/rpc.ts | 2 +- server/src/runtime.ts | 2 +- server/src/state.ts | 2 +- server/tsconfig.json | 1 + 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/server/src/level.ts b/server/src/level.ts index 94235a28e..0c8ef4415 100644 --- a/server/src/level.ts +++ b/server/src/level.ts @@ -18,8 +18,8 @@ function createLevelDocument(documentConstructor: any, json: any) { export class WrappedLevel extends Level { curId: number; - async open(): Promise; - async open(options?: OpenOptions): Promise { + override async open(): Promise; + override async open(options?: OpenOptions): Promise { await super.open(options); try { this.curId = parseInt(await this.get('_id') as string); diff --git a/server/src/plugin/plugin-remote-worker.ts b/server/src/plugin/plugin-remote-worker.ts index a5cfed955..24e6c7118 100644 --- a/server/src/plugin/plugin-remote-worker.ts +++ b/server/src/plugin/plugin-remote-worker.ts @@ -84,7 +84,7 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe class PluginForkableAPI extends PluginAPIProxy { [RpcPeer.PROPERTY_PROXY_ONEWAY_METHODS] = (_api as any)[RpcPeer.PROPERTY_PROXY_ONEWAY_METHODS]; - setStorage(nativeId: string, storage: { [key: string]: any; }): Promise { + override setStorage(nativeId: string, storage: { [key: string]: any; }): Promise { const id = deviceManager.nativeIds.get(nativeId).id; for (const r of forks) { r.setNativeId(nativeId, id, storage); @@ -316,7 +316,7 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe class PluginForkAPI extends PluginAPIProxy { [RpcPeer.PROPERTY_PROXY_ONEWAY_METHODS] = (api as any)[RpcPeer.PROPERTY_PROXY_ONEWAY_METHODS]; - setStorage(nativeId: string, storage: { [key: string]: any; }): Promise { + override setStorage(nativeId: string, storage: { [key: string]: any; }): Promise { const id = deviceManager.nativeIds.get(nativeId).id; pluginRemoteAPI.setNativeId(nativeId, id, storage); for (const r of forks) { diff --git a/server/src/plugin/runtime/node-fork-worker.ts b/server/src/plugin/runtime/node-fork-worker.ts index e22ae2f54..98f85046e 100644 --- a/server/src/plugin/runtime/node-fork-worker.ts +++ b/server/src/plugin/runtime/node-fork-worker.ts @@ -109,7 +109,7 @@ export class NodeForkWorker extends ChildProcessWorker { } } - get pid() { + override get pid() { return this.worker?.pid; } } diff --git a/server/src/plugin/runtime/python-worker.ts b/server/src/plugin/runtime/python-worker.ts index b8afd2707..3c0480901 100644 --- a/server/src/plugin/runtime/python-worker.ts +++ b/server/src/plugin/runtime/python-worker.ts @@ -33,11 +33,11 @@ export class PythonRuntimeWorker extends ChildProcessWorker { _stderr = new PassThrough(); pythonInstallationComplete = true; - get stdout() { + override get stdout() { return this._stdout; } - get stderr() { + override get stderr() { return this._stderr; } diff --git a/server/src/rpc.ts b/server/src/rpc.ts index 7890159c6..2232d8c0e 100644 --- a/server/src/rpc.ts +++ b/server/src/rpc.ts @@ -227,7 +227,7 @@ interface SerialiedRpcResultError { // todo: error constructor adds a "cause" variable in Chrome 93, Node v?? export class RPCResultError extends Error { - constructor(peer: RpcPeer, message: string, public cause?: Error, options?: { name: string, stack: string | undefined }) { + constructor(peer: RpcPeer, message: string, public override cause?: Error, options?: { name: string, stack: string | undefined }) { super(`${message}\n${peer.selfName}:${peer.peerName}`); if (options?.name) { diff --git a/server/src/runtime.ts b/server/src/runtime.ts index 2c4d19eeb..f7d121666 100644 --- a/server/src/runtime.ts +++ b/server/src/runtime.ts @@ -72,7 +72,7 @@ export class ScryptedRuntime extends PluginHttp { stateManager = new ScryptedStateManager(this); logger = new Logger(this, '', 'Scrypted'); devicesLogger = this.logger.getLogger('device', 'Devices'); - wss = new WebSocketServer({ noServer: true }); + override wss = new WebSocketServer({ noServer: true }); wsAtomic = 0; connectRPCObjectIO: IOServer = new io.Server({ pingTimeout: 120000, diff --git a/server/src/state.ts b/server/src/state.ts index 8d782b971..7d009cea0 100644 --- a/server/src/state.ts +++ b/server/src/state.ts @@ -149,7 +149,7 @@ export class ScryptedStateManager extends EventRegistry { return systemState; } - listenDevice(id: string, options: string | EventListenerOptions, callback: (eventDetails: EventDetails, eventData: any) => void): EventListenerRegister { + override listenDevice(id: string, options: string | EventListenerOptions, callback: (eventDetails: EventDetails, eventData: any) => void): EventListenerRegister { let { denoise, event, watch } = (options || {}) as EventListenerOptions; if (!event && typeof options === 'string') event = options as string; diff --git a/server/tsconfig.json b/server/tsconfig.json index c8eed0ce5..05ec2e4c9 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -10,6 +10,7 @@ "noImplicitThis": true, "strictFunctionTypes": true, "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, "outDir": "./dist", "esModuleInterop": true, "moduleResolution": "NodeNext",