Skip to content

Commit ae2c93c

Browse files
fix(tml-2891): replace bare as casts with isPlainRecord to satisfy lint:casts ratchet
Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
1 parent ab1b60a commit ae2c93c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/2-sql/1-core/contract/src/ir/sql-storage.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import type { StorageHashBase } from '@prisma-next/contract/types';
2-
import { freezeNode, NamespaceBase, type Storage } from '@prisma-next/framework-components/ir';
2+
import {
3+
freezeNode,
4+
isPlainRecord,
5+
NamespaceBase,
6+
type Storage,
7+
} from '@prisma-next/framework-components/ir';
38
import { SqlNode } from './sql-node';
49
import type { StorageTable } from './storage-table';
510
import {
@@ -102,7 +107,7 @@ export abstract class SqlNamespace extends NamespaceBase implements SqlNamespace
102107
* objects (`{ id, entries }`) do not.
103108
*/
104109
export function isMaterializedSqlNamespace(x: unknown): x is SqlNamespace {
105-
return typeof (x as { qualifyTable?: unknown } | null | undefined)?.qualifyTable === 'function';
110+
return isPlainRecord(x) && typeof x['qualifyTable'] === 'function';
106111
}
107112

108113
export class SqlStorage<THash extends string = string> extends SqlNode implements Storage {
@@ -153,7 +158,7 @@ function normaliseTypeEntry(name: string, entry: SqlStorageTypeEntry): StorageTy
153158
}
154159
return toStorageTypeInstance(entry);
155160
}
156-
const rawKind = (entry as { kind?: unknown }).kind;
161+
const rawKind = isPlainRecord(entry) ? entry['kind'] : undefined;
157162
const kindDescription =
158163
rawKind === undefined
159164
? 'missing `kind` discriminator'

0 commit comments

Comments
 (0)