Skip to content

Commit

Permalink
Node18 updates and Timer -> Timeout change (#1788)
Browse files Browse the repository at this point in the history
* Convert NodeJS.Timer to NodeJS.Timeout

variable typing is off with what clearTimeout() is expecting so
adjusting to match what (clear|set)Timeout() are expecting

Signed-off-by: John 'Warthog9' Hawley <[email protected]>

* Set Node16 dependency matching more explicitly so that npm can resolve correctly

Signed-off-by: John 'Warthog9' Hawley <[email protected]>

* Create 1788.misc

---------

Signed-off-by: John 'Warthog9' Hawley <[email protected]>
Co-authored-by: Will Hunt <[email protected]>
  • Loading branch information
warthog9 and Half-Shot authored Mar 21, 2024
1 parent e060290 commit fb339d0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/1788.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixup types for Timers so the bridge works with newer node versions.
2 changes: 1 addition & 1 deletion src/irc/BridgedClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class BridgedClient extends EventEmitter {
private connectDefer: promiseutil.Defer<void>;
public readonly log: BridgedClientLogger;
private cachedOperatorNicksInfo: {[channel: string]: GetNicksResponseOperators} = {};
private idleTimeout: NodeJS.Timer|null = null;
private idleTimeout: NodeJS.Timeout|null = null;
private whoisPendingNicks: Set<string> = new Set();
private state: State = {
status: BridgedClientStatus.CREATED
Expand Down
4 changes: 2 additions & 2 deletions src/irc/ConnectionInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export class IRCConnectionError extends Error {
export class ConnectionInstance {
public dead = false;
private state: "created"|"connecting"|"connected" = "created";
private pingRateTimerId: NodeJS.Timer|null = null;
private clientSidePingTimeoutTimerId: NodeJS.Timer|null = null;
private pingRateTimerId: NodeJS.Timeout|null = null;
private clientSidePingTimeoutTimerId: NodeJS.Timeout|null = null;
// eslint-disable-next-line no-use-before-define
private connectDefer: Defer<ConnectionInstance>;
public onDisconnect?: (reason: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion src/pool-service/CommandReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RedisCommandReader {
private shouldRun = true;
private commandStreamId = "$"
private supportsMinId = false;
private trimInterval?: NodeJS.Timer;
private trimInterval?: NodeJS.Timeout;

constructor(
private readonly redis: Redis,
Expand Down
2 changes: 1 addition & 1 deletion src/pool-service/IrcConnectionPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class IrcConnectionPool {
private commandStreamId = "$";
private metricsServer?: Server;
private shouldRun = true;
private heartbeatTimer?: NodeJS.Timer;
private heartbeatTimer?: NodeJS.Timeout;
private readonly commandReader: RedisCommandReader;

constructor(private readonly config: typeof Config) {
Expand Down
2 changes: 1 addition & 1 deletion src/pool-service/IrcPoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class IrcPoolClient extends (EventEmitter as unknown as new () => TypedEm
private readonly connections = new Map<ClientId, Promise<RedisIrcConnection>>();
public shouldRun = true;
private missedHeartbeats = 0;
private heartbeatInterval?: NodeJS.Timer;
private heartbeatInterval?: NodeJS.Timeout;
private commandReader: RedisCommandReader;
cmdReader: Redis;

Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"useUnknownInCatchVariables": false,
/* matrix-js-sdk throws up errors */
"skipLibCheck": true,
"module": "Node16",
"moduleResolution": "Node16"
},
"include": [
"src/**/*"
Expand Down

0 comments on commit fb339d0

Please sign in to comment.