diff --git a/src/query-builder/function-module.ts b/src/query-builder/function-module.ts index cfb7cda3c..028e27500 100644 --- a/src/query-builder/function-module.ts +++ b/src/query-builder/function-module.ts @@ -487,7 +487,7 @@ export interface FunctionModule { * ``` */ max< - O extends number | string | bigint | null = never, + O extends number | string | Date | bigint | null = never, RE extends ReferenceExpression = ReferenceExpression, >( expr: RE, @@ -495,7 +495,12 @@ export interface FunctionModule { DB, TB, IsNever extends true - ? ExtractTypeFromReferenceExpression + ? ExtractTypeFromReferenceExpression< + DB, + TB, + RE, + number | string | Date | bigint + > : O > @@ -538,7 +543,7 @@ export interface FunctionModule { * ``` */ min< - O extends number | string | bigint | null = never, + O extends number | string | Date | bigint | null = never, RE extends ReferenceExpression = ReferenceExpression, >( expr: RE, @@ -546,7 +551,12 @@ export interface FunctionModule { DB, TB, IsNever extends true - ? ExtractTypeFromReferenceExpression + ? ExtractTypeFromReferenceExpression< + DB, + TB, + RE, + number | string | Date | bigint + > : O > diff --git a/test/node/src/test-setup.ts b/test/node/src/test-setup.ts index e4d4951cc..1c6fce5ef 100644 --- a/test/node/src/test-setup.ts +++ b/test/node/src/test-setup.ts @@ -29,7 +29,6 @@ import { InsertResult, SqliteDialect, InsertQueryBuilder, - Logger, Generated, sql, ColumnType, diff --git a/test/typings/test-d/aggregate-function.test-d.ts b/test/typings/test-d/aggregate-function.test-d.ts index 04323f6dc..4a35fd24a 100644 --- a/test/typings/test-d/aggregate-function.test-d.ts +++ b/test/typings/test-d/aggregate-function.test-d.ts @@ -339,13 +339,13 @@ async function testSelectWithDynamicReference(db: Kysely) { expectNotAssignable(result.count) expectAssignable(result.another_count) expectNotAssignable(result.another_count) - expectAssignable(result.max) + expectAssignable(result.max) expectNotAssignable(result.max) expectAssignable(result.another_max) expectNotAssignable(result.another_max) expectAssignable(result.nullable_max) expectNotAssignable(result.nullable_max) - expectAssignable(result.min) + expectAssignable(result.min) expectNotAssignable(result.min) expectAssignable(result.another_min) expectNotAssignable(result.another_min)