porsager / porsager/postgres

error TS2345: Argument of type 'TransactionSql<{}>' is not assignable to parameter of type 'Sql<{}>'

Open
#1,163 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Typescript
Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

This is typescript.

src/importdog.ts(58,92): error TS2345: Argument of type 'TransactionSql<{}>' is not assignable to parameter of type 'Sql<{}>'.
Type 'TransactionSql<{}>' is missing the following properties from type 'Sql<{}>': CLOSE, END, PostgresError, options, and 7 more.

This works in postgres 3.4.7. It didn't work in 3.4.8. It doesn't work in 3.4.9.

export const dog_subsidy = postgres({
            user: 'dog_subsidy',
            password: process.env.DOG_SUBSIDY_PASSWORD,
            host: 'localhost',
            port: 5432,
            database: 'dog_subsidy',
            max: os.cpus().length,
            debug: postgres_logger
        })
export async function sp_personsimm_create_v1(params: IfsPersonParamsSpPersonsimmCreateV1, breadcrumb: string, db = dog_subsidy): Promise<number |UserError> {
await dog_subsidy.begin(async conn => {
                const breeder = dog.breeder
                const breeder_imm =
                    new PersonParamsSpPersonsimmCreateV1(breeder.social_security_number.toString(), undefined)
                const breederimm_pk = await sp_personsimm_create_v1(breeder_imm, uuidv4(), conn)

The error is the last parameter in call to await sp_personsimm_create_v1(breeder_imm, uuidv4(), conn)

$ grep -e postgres -e typescript -e 'tsup":' package.json
    "postgres": "3.4.9",
    "tsup": "8.5.1",
    "typescript": "5.9.3",
$ node --version
v22.16.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/importdog.ts:58 and reproduce the TypeScript error at the call to sp_personsimm_create_v1 using postgres 3.4.9. Compare the relevant type definitions or behavior with postgres 3.4.7, then verify that TransactionSql is accepted for the database parameter and that the TypeScript check succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, postgres, typescript
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.