Skip to content

Commit

Permalink
fix merge query results not be inferred.
Browse files Browse the repository at this point in the history
remove debug noise.
  • Loading branch information
igalklebanov committed Jun 27, 2024
1 parent 0dd0978 commit d850122
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/query-builder/merge-query-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ export class WheneableMergeQueryBuilder<
)
}

compile(): CompiledQuery<never> {
compile(): CompiledQuery<O> {
return this.#props.executor.compileQuery(
this.toOperationNode(),
this.#props.queryId,
Expand Down
14 changes: 14 additions & 0 deletions test/typings/test-d/infer-result.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
InferResult,
InsertResult,
Kysely,
MergeResult,
Selectable,
UpdateResult,
} from '..'
Expand Down Expand Up @@ -128,3 +129,16 @@ function testInferResultDeleteQuery(db: Kysely<Database>) {
expectType<Equals<Expected2, InferResult<typeof query2>>>(true)
expectType<Equals<Expected2, InferResult<typeof compiledQuery2>>>(true)
}

function testInferResultMergeQuery(db: Kysely<Database>) {
const query0 = db
.mergeInto('person')
.using('pet', 'pet.owner_id', 'person.id')
.whenMatched()
.thenDelete()
const compiledQuery0 = query0.compile()

type Expected0 = MergeResult[]
expectType<Equals<Expected0, InferResult<typeof query0>>>(true)
expectType<Equals<Expected0, InferResult<typeof compiledQuery0>>>(true)
}

0 comments on commit d850122

Please sign in to comment.