Skip to content

Commit dc66616

Browse files
committed
fix(sql-orm-client): replace bare as casts in resolveThrough with castAs
The 5 bare `as` casts in `resolveThrough` (parentColumns/childColumns in the Set spread, and all three *Columns in the return object) were declarative widenings from `unknown[]` to `readonly string[]`. Replace all five with `castAs<readonly string[]>(…)` from `@prisma-next/utils/casts` per the no-bare-casts rule. No behaviour change. lint:casts delta: -1. Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>
1 parent 3c2bdb6 commit dc66616

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

packages/3-extensions/sql-orm-client/src/collection-contract.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
domainModelsAtDefaultNamespace,
66
} from '@prisma-next/contract/types';
77
import type { SqlStorage, StorageTable } from '@prisma-next/sql-contract/types';
8+
import { castAs } from '@prisma-next/utils/casts';
89
import {
910
resolveDomainModelForContract,
1011
resolveTableForContract,
@@ -272,8 +273,8 @@ function resolveThrough(
272273
}
273274

274275
const fkColumnSet = new Set<string>([
275-
...(parentColumns as string[]),
276-
...(childColumns as string[]),
276+
...castAs<readonly string[]>(parentColumns),
277+
...castAs<readonly string[]>(childColumns),
277278
]);
278279
const junctionTable = unboundTable(contract, table);
279280
const requiredPayloadColumns: string[] = [];
@@ -287,9 +288,9 @@ function resolveThrough(
287288

288289
return {
289290
table,
290-
parentColumns: parentColumns as readonly string[],
291-
childColumns: childColumns as readonly string[],
292-
targetColumns: targetColumns as readonly string[],
291+
parentColumns: castAs<readonly string[]>(parentColumns),
292+
childColumns: castAs<readonly string[]>(childColumns),
293+
targetColumns: castAs<readonly string[]>(targetColumns),
293294
requiredPayloadColumns,
294295
};
295296
}

0 commit comments

Comments
 (0)