Skip to content

Commit 61b6f7f

Browse files
thomasballingerConvex, Inc.
authored andcommitted
Avoid some unused locals in convex-js (#39873)
GitOrigin-RevId: 587b36cf5687f9676f4e479e3cc9f341573eee1b
1 parent c43d2c1 commit 61b6f7f

File tree

16 files changed

+30
-31
lines changed

16 files changed

+30
-31
lines changed

npm-packages/convex/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"postpack": "node scripts/postpack.mjs",
195195
"test": "vitest --silent",
196196
"test-not-silent": "vitest",
197-
"new-test": "vitest",
197+
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
198198
"test-esm": "node ./scripts/test-esm.mjs && ./scripts/checkdeps.mjs && ./scripts/checkimports.mjs"
199199
},
200200
"files": [

npm-packages/convex/src/browser/logging.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function instantiateDefaultLogger(options: {
109109
console.error(...args);
110110
break;
111111
default: {
112-
const _typecheck: never = level;
112+
level satisfies never;
113113
console.log(...args);
114114
}
115115
}

npm-packages/convex/src/browser/sync/authentication_manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ export class AuthenticationManager {
449449
case "initialRefetch":
450450
break;
451451
default: {
452-
const _typeCheck: never = newAuth;
452+
newAuth satisfies never;
453453
}
454454
}
455455
if (this.authState.state === "waitingForScheduledRefetch") {

npm-packages/convex/src/browser/sync/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ export class BaseConvexClient {
467467
case "Ping":
468468
break; // do nothing
469469
default: {
470-
const _typeCheck: never = serverMessage;
470+
serverMessage satisfies never;
471471
}
472472
}
473473

npm-packages/convex/src/browser/sync/local_state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class LocalSyncState {
157157
}
158158
default: {
159159
// Enforce that the switch-case is exhaustive.
160-
const _: never = modification;
160+
modification satisfies never;
161161
throw new Error(`Invalid modification ${(modification as any).type}`);
162162
}
163163
}

npm-packages/convex/src/browser/sync/protocol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function parseServerMessage(
4848
};
4949
}
5050
default: {
51-
const _exhaustivenessCheck: never = encoded;
51+
encoded satisfies never;
5252
}
5353
}
5454
return undefined as never;
@@ -76,7 +76,7 @@ export function encodeClientMessage(
7676
}
7777
}
7878
default: {
79-
const _exhaustivenessCheck: never = message;
79+
message satisfies never;
8080
}
8181
}
8282
return undefined as never;

npm-packages/convex/src/browser/sync/remote_query_set.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class RemoteQuerySet {
7878
}
7979
default: {
8080
// Enforce that the switch-case is exhaustive.
81-
const _: never = modification;
81+
modification satisfies never;
8282
throw new Error(`Invalid modification ${(modification as any).type}`);
8383
}
8484
}

npm-packages/convex/src/browser/sync/web_socket_manager.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export class WebSocketManager {
412412
}
413413
default: {
414414
// Enforce that the switch-case is exhaustive.
415-
const _: never = this.socket;
415+
this.socket satisfies never;
416416
}
417417
}
418418
}
@@ -457,7 +457,7 @@ export class WebSocketManager {
457457
}
458458
default: {
459459
// Enforce that the switch-case is exhaustive.
460-
const _: never = this.socket;
460+
this.socket satisfies never;
461461
return Promise.resolve();
462462
}
463463
}
@@ -483,7 +483,7 @@ export class WebSocketManager {
483483
}
484484
default: {
485485
// Enforce that the switch-case is exhaustive.
486-
const _: never = this.socket;
486+
this.socket satisfies never;
487487
throw new Error(
488488
`Invalid websocket state: ${(this.socket as any).state}`,
489489
);
@@ -506,7 +506,7 @@ export class WebSocketManager {
506506
}
507507
default: {
508508
// Enforce that the switch-case is exhaustive.
509-
const _: never = this.socket;
509+
this.socket satisfies never;
510510
return Promise.resolve();
511511
}
512512
}
@@ -528,7 +528,7 @@ export class WebSocketManager {
528528
return;
529529
default: {
530530
// Enforce that the switch-case is exhaustive.
531-
const _: never = this.socket;
531+
this.socket satisfies never;
532532
}
533533
}
534534
this.connect();
@@ -548,7 +548,7 @@ export class WebSocketManager {
548548
}
549549
default: {
550550
// Enforce that the switch-case is exhaustive.
551-
const _: never = this.socket;
551+
this.socket satisfies never;
552552
return;
553553
}
554554
}
@@ -581,7 +581,7 @@ export class WebSocketManager {
581581
return;
582582
default: {
583583
// Enforce that the switch-case is exhaustive.
584-
const _: never = this.socket;
584+
this.socket satisfies never;
585585
}
586586
}
587587
this.connect();

npm-packages/convex/src/cli/lib/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export async function checkAccessToSelectedProject(
239239
// it will instead fail as soon as we try to use the key.
240240
return { kind: "unknown" };
241241
default: {
242-
const _exhaustivenessCheck: never = projectSelection;
242+
projectSelection satisfies never;
243243
return await ctx.crash({
244244
exitCode: 1,
245245
errorType: "fatal",
@@ -424,7 +424,7 @@ async function handleOwnDev(
424424
};
425425
}
426426
default: {
427-
const _exhaustivenessCheck: never = projectSelection;
427+
projectSelection satisfies never;
428428
return ctx.crash({
429429
exitCode: 1,
430430
errorType: "fatal",
@@ -573,7 +573,7 @@ async function fetchDeploymentCredentialsWithinCurrentProject(
573573
projectSelection,
574574
);
575575
default: {
576-
const _exhaustivenessCheck: never = deploymentSelection;
576+
deploymentSelection satisfies never;
577577
return ctx.crash({
578578
exitCode: 1,
579579
errorType: "fatal",
@@ -737,7 +737,7 @@ export async function loadSelectedDeploymentCredentials(
737737
};
738738
}
739739
default: {
740-
const _exhaustivenessCheck: never = deploymentSelection;
740+
deploymentSelection satisfies never;
741741
return await ctx.crash({
742742
exitCode: 1,
743743
errorType: "fatal",

npm-packages/convex/src/cli/lib/convexExport.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function exportFromDeployment(
7676
});
7777
}
7878
default: {
79-
const _: never = snapshotExportState;
79+
snapshotExportState satisfies never;
8080
return await ctx.crash({
8181
exitCode: 1,
8282
errorType: "fatal",
@@ -137,7 +137,7 @@ async function waitForStableExportState(
137137
onDone();
138138
break;
139139
default: {
140-
const _: never = snapshotExportState;
140+
snapshotExportState satisfies never;
141141
onDone();
142142
}
143143
}

0 commit comments

Comments
 (0)