Whoops change types to how mathjs actually works

This commit is contained in:
Matt Vague 2022-09-08 17:46:29 -07:00
parent be97efa9a0
commit fcabc9722b
2 changed files with 1 additions and 3 deletions

2
types/index.d.ts vendored
View File

@ -2204,7 +2204,6 @@ declare namespace math {
* when number is > 1.
*/
pickRandom<T>(array: T[]): T
pickRandom<T>(array: T[], number: 1, weights?: number[]): T
pickRandom<T>(array: T[], number: number): T[]
pickRandom<T>(array: T[], number: number, weights: number[]): T[]
@ -5525,7 +5524,6 @@ declare namespace math {
* @param weights An array of ints or floats
*/
pickRandom<T>(array: T[]): MathJsChain<T>
pickRandom<T>(array: T[], number: 1, weights?: number[]): MathJsChain<T>
pickRandom<T>(array: T[], number: number): MathJsChain<T[]>
pickRandom<T>(array: T[], number: number, weights: number[]): MathJsChain<T[]>

View File

@ -2256,7 +2256,7 @@ Random examples
expectTypeOf(math.pickRandom(['a', { b: 10 }, 42])).toMatchTypeOf<
string | number | { b: number }
>()
expectTypeOf(math.pickRandom([1, 2, 3], 1)).toMatchTypeOf<number>()
expectTypeOf(math.pickRandom([1, 2, 3])).toMatchTypeOf<number>()
expectTypeOf(math.pickRandom([1, 2, 3], 2)).toMatchTypeOf<number[]>()
expectTypeOf(math.chain().pickRandom([1, 2, 3], 2)).toMatchTypeOf<MathJsChain<number[]>>()