Skip to content

Commit

Permalink
Further improve quantileSeq typings
Browse files Browse the repository at this point in the history
  • Loading branch information
domdomegg committed Jun 21, 2024
1 parent 5785cb9 commit 94e3f35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions test/typescript-tests/testTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2543,6 +2543,12 @@ Statistics functions' return types
>()

expectTypeOf(math.quantileSeq([1, 2, 3], 0.75)).toMatchTypeOf<number>()
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<number[]>()
expectTypeOf(math.quantileSeq([[1, 2, 3]], 0.75)).toMatchTypeOf<number>()
expectTypeOf(
math.quantileSeq([math.bignumber('123')], 0.75)
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2866,7 +2866,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
quantileSeq<T extends MathScalarType>(
A: T[] | T[][],
prob: number | BigNumber | MathArray,
prob: number | BigNumber,
sorted?: boolean
): T
/**
Expand Down

0 comments on commit 94e3f35

Please sign in to comment.