- I installed `@types/uuid` because typescript required it in a file - In `packages/db-sqlite/src/index.ts` I see four more errors in my IDE that don't appear when I run the typecheck in the CLI with `tsc --noEmit`. The same thing happened in https://github.com/payloadcms/payload/pull/11560. Also referencing https://github.com/payloadcms/payload/pull/11226#issuecomment-2713898801 for traceability.
18 lines
695 B
TypeScript
18 lines
695 B
TypeScript
import type { Insert, SQLiteAdapter } from './types.js'
|
|
|
|
export const insert: Insert = async function (
|
|
// Here 'this' is not a parameter. See:
|
|
// https://www.typescriptlang.org/docs/handbook/2/classes.html#this-parameters
|
|
this: SQLiteAdapter,
|
|
{ db, onConflictDoUpdate, tableName, values },
|
|
): Promise<Record<string, unknown>[]> {
|
|
const table = this.tables[tableName]
|
|
|
|
const result = onConflictDoUpdate
|
|
? await db.insert(table).values(values).onConflictDoUpdate(onConflictDoUpdate).returning()
|
|
: await db.insert(table).values(values).returning()
|
|
|
|
// See https://github.com/payloadcms/payload/pull/11831#discussion_r2010431908
|
|
return result as Record<string, unknown>[]
|
|
}
|