Skip to content

Commit 46c607b

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 6f1e1b6 commit 46c607b

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
contractModels,
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 type { RelationCardinalityTag } from './types';
910

1011
type ModelStorageFields = Record<string, { column?: string }>;
@@ -271,8 +272,8 @@ function resolveThrough(
271272
}
272273

273274
const fkColumnSet = new Set<string>([
274-
...(parentColumns as string[]),
275-
...(childColumns as string[]),
275+
...castAs<readonly string[]>(parentColumns),
276+
...castAs<readonly string[]>(childColumns),
276277
]);
277278
const junctionTable = unboundTable(contract, table);
278279
const requiredPayloadColumns: string[] = [];
@@ -286,9 +287,9 @@ function resolveThrough(
286287

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

0 commit comments

Comments
 (0)