From 1db2ba6d3b17be7924ee4747ac1effc0e4f63e4c Mon Sep 17 00:00:00 2001 From: Adam Jones Date: Fri, 28 Jun 2024 11:15:09 +0100 Subject: [PATCH] Further improve quantileSeq typings (#3223) Co-authored-by: Jos de Jong --- test/typescript-tests/testTypes.ts | 6 ++++++ types/index.d.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/test/typescript-tests/testTypes.ts b/test/typescript-tests/testTypes.ts index c61ee15a68..d3419a2c6f 100644 --- a/test/typescript-tests/testTypes.ts +++ b/test/typescript-tests/testTypes.ts @@ -2548,6 +2548,12 @@ Statistics functions' return types >() expectTypeOf(math.quantileSeq([1, 2, 3], 0.75)).toMatchTypeOf() + expectTypeOf(math.quantileSeq([1, 2, 3, 4, 5], [0.25, 0.75])).toMatchTypeOf< + MathArray | MathScalarType + >() + expectTypeOf( + math.quantileSeq([1, 2, 3, 4, 5], [0.25, 0.75]) as number[] + ).toMatchTypeOf() expectTypeOf(math.quantileSeq([[1, 2, 3]], 0.75)).toMatchTypeOf() expectTypeOf( math.quantileSeq([math.bignumber('123')], 0.75) diff --git a/types/index.d.ts b/types/index.d.ts index f08c74dcd9..37603ac135 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -2866,7 +2866,7 @@ export interface MathJsInstance extends MathJsFactory { */ quantileSeq( A: T[] | T[][], - prob: number | BigNumber | MathArray, + prob: number | BigNumber, sorted?: boolean ): T /**