Skip to content

Commit

Permalink
Merge pull request #10 from baileys-li/types
Browse files Browse the repository at this point in the history
Correct types for const arrays
  • Loading branch information
ChrisCavs authored Jun 12, 2023
2 parents 469a2ce + 9ce51ec commit 4158c35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/one-of.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { intRange } from './int-range'
import { Engine, defaultEngine } from './utils'

const oneOf = <T>(arr: T[], engine: Engine = defaultEngine): T => {
const oneOf = <T>(arr: T[] | readonly T[], engine: Engine = defaultEngine): T => {
return arr[intRange(0, arr.length - 1, engine)]
}

const oneOfWithEngine = <T>(engine: Engine = defaultEngine) => {
return (arr: T[]) => oneOf(arr, engine)
return (arr: T[] | readonly T[]) => oneOf(arr, engine)
}

export {
Expand Down

0 comments on commit 4158c35

Please sign in to comment.