From dd6eff087292173ec670aec8ea40667d59e0b347 Mon Sep 17 00:00:00 2001 From: igalklebanov Date: Thu, 27 Jun 2024 20:51:23 +0300 Subject: [PATCH] fix merge query results not be inferred. remove debug noise. .. --- src/query-builder/merge-query-builder.ts | 2 +- test/typings/test-d/infer-result.test-d.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/query-builder/merge-query-builder.ts b/src/query-builder/merge-query-builder.ts index 4792d234f..b469816b8 100644 --- a/src/query-builder/merge-query-builder.ts +++ b/src/query-builder/merge-query-builder.ts @@ -703,7 +703,7 @@ export class WheneableMergeQueryBuilder< ) } - compile(): CompiledQuery { + compile(): CompiledQuery { return this.#props.executor.compileQuery( this.toOperationNode(), this.#props.queryId, diff --git a/test/typings/test-d/infer-result.test-d.ts b/test/typings/test-d/infer-result.test-d.ts index 088a191b9..4ec7ed3a0 100644 --- a/test/typings/test-d/infer-result.test-d.ts +++ b/test/typings/test-d/infer-result.test-d.ts @@ -6,6 +6,7 @@ import { InferResult, InsertResult, Kysely, + MergeResult, Selectable, UpdateResult, } from '..' @@ -128,3 +129,16 @@ function testInferResultDeleteQuery(db: Kysely) { expectType>>(true) expectType>>(true) } + +function testInferResultMergeQuery(db: Kysely) { + const query0 = db + .mergeInto('person') + .using('pet', 'pet.owner_id', 'person.id') + .whenMatched() + .thenDelete() + const compiledQuery0 = query0.compile() + + type Expected0 = MergeResult + expectType>>(true) + expectType>>(true) +}