Skip to content

Commit d5b0d15

Browse files
committed
chore(deps-dev): bump typescript from 5.8.3 to 6.0.3
TypeScript 6.0 enforces stricter function parameter variance. Fixes: - cast typed event handlers to (...args: unknown[]) => void at register call sites in CrossSignalRuleEngine (no eslint-disable needed since the casts are genuinely required by the new strictness) - add `as unknown as` double-cast for RegExpExecArray→tuple in static-scanner.ts (TS6 no longer allows direct narrowing cast) - cast fs[method] to FsMethod at both set/createPatch call sites - change diagnostics_channel listeners in tests from typed parameter to unknown and cast inside (ChannelListener now requires unknown) - fix process.stderr.write mock spread in expiry-signal.test.ts
1 parent 0a0466e commit d5b0d15

14 files changed

Lines changed: 76 additions & 72 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"husky": "^9.1.7",
2828
"jiti": "^2.4.2",
2929
"prettier": "^3.8.3",
30-
"typescript": "^5.8.3",
30+
"typescript": "^6.0.3",
3131
"typescript-eslint": "^8.59.1"
3232
}
3333
}

packages/agent/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"eslint": "^10.3.0",
8080
"jiti": "^2.4.2",
8181
"prettier": "^3.8.3",
82-
"typescript": "^5.8.3",
82+
"typescript": "^6.0.3",
8383
"typescript-eslint": "^8.59.1"
8484
},
8585
"dependencies": {

packages/agent/src/analysis/cross-signal-rule-engine.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ export class CrossSignalRuleEngine {
182182
});
183183
};
184184

185-
this.register("query", onQuery);
186-
this.register("http", onHttp);
187-
this.register("slow-query", onSlowQuery);
188-
this.register("pool-exhaustion", onPoolExhaustion);
185+
this.register("query", onQuery as (...args: unknown[]) => void);
186+
this.register("http", onHttp as (...args: unknown[]) => void);
187+
this.register("slow-query", onSlowQuery as (...args: unknown[]) => void);
188+
this.register("pool-exhaustion", onPoolExhaustion as (...args: unknown[]) => void);
189189

190190
// R.7 hot-path-select-star
191191
if (this.opts.columnUsageDir) {
@@ -235,7 +235,7 @@ export class CrossSignalRuleEngine {
235235
});
236236
};
237237

238-
this.register("query", onQueryForColUsage);
238+
this.register("query", onQueryForColUsage as (...args: unknown[]) => void);
239239
}
240240
}
241241

packages/agent/src/analysis/explain-analyzer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class ExplainAnalyzer extends EventEmitter {
9595
timestamp: now,
9696
} satisfies ExplainResult);
9797
} catch (err) {
98-
this.emit("error", err as Error);
98+
this.emit("error", err);
9999
}
100100
}
101101

packages/agent/src/analysis/static-scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ export class StaticScanner extends EventEmitter {
499499

500500
let match;
501501
while ((match = regex.exec(output)) !== null) {
502-
const [, filePath, line, col, , code, message] = match as [
502+
const [, filePath, line, col, , code, message] = match as unknown as [
503503
string,
504504
string,
505505
string,

packages/agent/src/instrumentation/drivers/patch-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ export function wrapMethod(
118118
error: err ?? undefined,
119119
cacheHit,
120120
} satisfies PatchedQueryMessage);
121-
return originalCallback.call(this, err, ...cbArgs) as unknown;
121+
return originalCallback.call(this, err, ...cbArgs);
122122
};
123-
return original.apply(this, args) as unknown;
123+
return original.apply(this, args);
124124
}
125125

126126
const result = original.apply(this, args);

packages/agent/src/instrumentation/fs.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ export class FsInstrumentation extends EventEmitter {
5656

5757
for (const method of methodsToPatch) {
5858
if (typeof fs[method] === "function" && !this.originalMethods.has(method)) {
59-
this.originalMethods.set(method, fs[method]);
60-
(fs as Record<string, unknown>)[method] = this.createPatch(method, fs[method]);
59+
this.originalMethods.set(method, fs[method] as FsMethod);
60+
(fs as Record<string, unknown>)[method] = this.createPatch(
61+
method,
62+
fs[method] as FsMethod,
63+
);
6164
}
6265
}
6366

packages/agent/src/instrumentation/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class HttpInstrumentation extends EventEmitter {
156156
(http as Record<string, unknown>).request = (
157157
...args: Parameters<typeof http.request>
158158
): http.ClientRequest => {
159-
const req = origHttp.apply(http, args) as http.ClientRequest;
159+
const req = origHttp.apply(http, args);
160160
const { method, url } = parseArgs("http:", args[0]);
161161
this._trackClientRequest(req, method, url, performance.now());
162162
return req;
@@ -168,7 +168,7 @@ export class HttpInstrumentation extends EventEmitter {
168168
(https as Record<string, unknown>).request = (
169169
...args: Parameters<typeof https.request>
170170
): http.ClientRequest => {
171-
const req = origHttps.apply(https, args) as http.ClientRequest;
171+
const req = origHttps.apply(https, args);
172172
const { method, url } = parseArgs("https:", args[0]);
173173
this._trackClientRequest(req, method, url, performance.now());
174174
return req;

packages/agent/tests/instrumentation/drivers-grpc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function collectMessages(fn: () => void | Promise<void>): Promise<PatchedQueryMe
3838
return new Promise(async (resolve) => {
3939
const ch = diagnostics_channel.channel(AUTO_PATCH_CHANNEL);
4040
const messages: PatchedQueryMessage[] = [];
41-
const listener = (msg: PatchedQueryMessage) => messages.push(msg);
41+
const listener = (msg: unknown) => messages.push(msg as PatchedQueryMessage);
4242
ch.subscribe(listener);
4343
try {
4444
await fn();

packages/agent/tests/instrumentation/drivers-mock.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function collectMessages(fn: () => void | Promise<void>): Promise<PatchedQueryMe
3535
return new Promise(async (resolve) => {
3636
const ch = diagnostics_channel.channel(AUTO_PATCH_CHANNEL);
3737
const messages: PatchedQueryMessage[] = [];
38-
const listener = (msg: PatchedQueryMessage) => messages.push(msg);
38+
const listener = (msg: unknown) => messages.push(msg as PatchedQueryMessage);
3939
ch.subscribe(listener);
4040
try {
4141
await fn();

0 commit comments

Comments
 (0)