The type ‘TransactionSql<{}>’ has no call signature.
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
Hi,
With new version 3.4.8, I have types validation errors when I use transaction. If I rollback to 3.4.7, I have no problem :
await sql.begin(async (sql) => {
for (const data of message.data) {
// Impossible to call sql`` or sql() inside sql.begin
// because the type ‘TransactionSql<{}>’ has no call signature.
await sql`
insert into ${sql(`${message.company}_measures`)} (
time, place, point, type, label, value,
receptionTime, sequence,
durationControl, statusControl,
isControlled, isQualified,
controlMessages
) values (
${message.time}, ${message.place}, ${message.point}, ${data.type}, ${data.label}, ${data.value},
${message.receptionTime || null}, ${message.sequence || null},
${data.durationControl ?? null}, ${data.statusControl || '02_success_noControls'},
${data.isControlled ?? true}, ${data.isQualified ?? true},
${data.controlMessages ? JSON.stringify(data.controlMessages) : null}
)
`;
}
});
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the type-checking error with the sql.begin snippet and compare the transaction typings between versions 3.4.8 and 3.4.7. Trace how TransactionSql is defined and verify that the resulting types allow sql`` or sql() inside the transaction callback without errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, postgresql, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100