mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 15:43:13 +09:00
Fix bad typings left over from the migration
This commit is contained in:
1 parent
7314dc99c8
commit
80e1904175
22 files changed
+93
-117
No files matched your search
@@ -27,7 +27,7 @@ export default class RateLimiter {
|
||||
/**
|
||||
* Callback invoked at most `maxRate` per second on activation.
|
||||
*/
|
||||
action?: Function;
|
||||
action?: () => void;
|
||||
|
||||
private _lastRun = 0;
|
||||
private _runTimeout?: ReturnType<typeof setTimeout>;
|
||||
@@ -43,7 +43,7 @@ export default class RateLimiter {
|
||||
* @param options.action -
|
||||
* Callback invoked at maste `maxRate` per second on activation.
|
||||
*/
|
||||
constructor(options: { maxRate?: number, action?: Function } = {}) {
|
||||
constructor(options: { maxRate?: number, action?: () => void } = {}) {
|
||||
this.maxRate = options.maxRate || 1;
|
||||
this.action = options.action || undefined;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function timeout<T>(promise: Promise<T>, time: number, timeoutResul
|
||||
try {
|
||||
return await Promise.race([
|
||||
promise,
|
||||
new Promise(resolve => {
|
||||
new Promise<T>(resolve => {
|
||||
timer = setTimeout(() => resolve(timeoutResult), time);
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -101,10 +101,6 @@ export abstract class WebSocketBaseConnector extends BaseConnector {
|
||||
_lastReceivedSeq = undefined;
|
||||
_sendBuffer: (libData.MessageRoutable)[] = [];
|
||||
|
||||
constructor(src: libData.Address, dst: libData.Address) {
|
||||
super(src, dst);
|
||||
}
|
||||
|
||||
_reset() {
|
||||
this._state = "closed";
|
||||
this._closing = false;
|
||||
|
||||
@@ -44,7 +44,7 @@ export class ConsoleTransport extends Transport {
|
||||
this.filter = options.filter || (() => true);
|
||||
}
|
||||
|
||||
log(info: any, callback: Function) {
|
||||
log(info: any, callback: () => void) {
|
||||
if (!this.filter(info)) {
|
||||
return callback();
|
||||
}
|
||||
@@ -70,7 +70,7 @@ export class WebConsoleFormat {
|
||||
public options = {}
|
||||
) { }
|
||||
|
||||
transform(info: any, _options: {}) {
|
||||
transform(info: any, _options: object) {
|
||||
let src = " ";
|
||||
if (info.host_id !== undefined) {
|
||||
src += `s:${info.host_name} - `;
|
||||
@@ -174,5 +174,5 @@ export type Logger = Omit<winston.Logger,
|
||||
info: winston.LeveledLogMethod,
|
||||
server: winston.LeveledLogMethod,
|
||||
verbose: winston.LeveledLogMethod,
|
||||
child(options: Object): Logger,
|
||||
child(options: object): Logger,
|
||||
};
|
||||
@@ -201,7 +201,7 @@ export class LinkTransport extends Transport {
|
||||
this.filter = options.filter;
|
||||
}
|
||||
|
||||
log(info: any, callback: Function) {
|
||||
log(info: any, callback: () => void) {
|
||||
if (this.filter && !this.filter(info)) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
*/
|
||||
import * as libHelpers from "./helpers";
|
||||
import type { Logger } from "./logging";
|
||||
import type { ConfigGroup } from "./config";
|
||||
import type { ConfigGroup, PluginConfigGroup } from "./config";
|
||||
import type { CollectorResult } from "./prometheus";
|
||||
import type { ParsedFactorioOutput } from "./logging_utils";
|
||||
import type { ModPack, ModInfo } from "./data";
|
||||
import type { Link } from "./link";
|
||||
import type { CommandTree } from "./command";
|
||||
import type { User } from "./users";
|
||||
import type { MessageRequest, MessageEvent } from "./data";
|
||||
import type { PluginConfigGroup } from "./config";
|
||||
|
||||
/**
|
||||
* Conceptual base for controller and instance plugins.
|
||||
@@ -365,7 +362,7 @@ export class BaseControllerPlugin {
|
||||
constructor(
|
||||
public info: PluginNodeEnvInfo,
|
||||
public controller: Controller,
|
||||
public metrics: any[],
|
||||
public metrics: any,
|
||||
logger: Logger
|
||||
) {
|
||||
this.logger = logger.child({ plugin: this.info.name }) as unknown as Logger;
|
||||
|
||||
Reference in new issue
Block a user