mirror of
https://github.com/koush/scrypted.git
synced 2026-05-05 22:00:27 +01:00
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
This commit is contained in:
@@ -18,8 +18,8 @@ function createLevelDocument(documentConstructor: any, json: any) {
|
||||
export class WrappedLevel extends Level<string, string | number> {
|
||||
curId: number;
|
||||
|
||||
async open(): Promise<void>;
|
||||
async open(options?: OpenOptions): Promise<void> {
|
||||
override async open(): Promise<void>;
|
||||
override async open(options?: OpenOptions): Promise<void> {
|
||||
await super.open(options);
|
||||
try {
|
||||
this.curId = parseInt(await this.get('_id') as string);
|
||||
|
||||
@@ -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<void> {
|
||||
override setStorage(nativeId: string, storage: { [key: string]: any; }): Promise<void> {
|
||||
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<void> {
|
||||
override setStorage(nativeId: string, storage: { [key: string]: any; }): Promise<void> {
|
||||
const id = deviceManager.nativeIds.get(nativeId).id;
|
||||
pluginRemoteAPI.setNativeId(nativeId, id, storage);
|
||||
for (const r of forks) {
|
||||
|
||||
@@ -109,7 +109,7 @@ export class NodeForkWorker extends ChildProcessWorker {
|
||||
}
|
||||
}
|
||||
|
||||
get pid() {
|
||||
override get pid() {
|
||||
return this.worker?.pid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -72,7 +72,7 @@ export class ScryptedRuntime extends PluginHttp<HttpPluginData> {
|
||||
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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
"outDir": "./dist",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "NodeNext",
|
||||
|
||||
Reference in New Issue
Block a user