Skip to content

Commit

Permalink
Further improve quantileSeq typings (#3223)
Browse files Browse the repository at this point in the history
Co-authored-by: Jos de Jong <[email protected]>
  • Loading branch information
domdomegg and josdejong authored Jun 28, 2024
1 parent 4319616 commit 1db2ba6
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 @@ -2548,6 +2548,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 1db2ba6

Please sign in to comment.