Skip to content

Commit

Permalink
fix(TS): allow readonly arrays as inputs (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
diesieben07 authored Sep 15, 2021
1 parent fba154b commit 6ce7833
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type KeyOption<ItemType> =
| string

interface MatchSorterOptions<ItemType = unknown> {
keys?: Array<KeyOption<ItemType>>
keys?: ReadonlyArray<KeyOption<ItemType>>
threshold?: Ranking
baseSort?: BaseSorter<ItemType>
keepDiacritics?: boolean
Expand Down Expand Up @@ -82,7 +82,7 @@ const defaultBaseSortFn: BaseSorter<unknown> = (a, b) =>
* @return {Array} - the new sorted array
*/
function matchSorter<ItemType = string>(
items: Array<ItemType>,
items: ReadonlyArray<ItemType>,
value: string,
options: MatchSorterOptions<ItemType> = {},
): Array<ItemType> {
Expand Down Expand Up @@ -120,7 +120,7 @@ function matchSorter<ItemType = string>(
*/
function getHighestRanking<ItemType>(
item: ItemType,
keys: Array<KeyOption<ItemType>> | undefined,
keys: ReadonlyArray<KeyOption<ItemType>> | undefined,
value: string,
options: MatchSorterOptions<ItemType>,
): RankingInfo {
Expand Down Expand Up @@ -445,7 +445,7 @@ function getNestedValues<ItemType>(
*/
function getAllValuesToRank<ItemType>(
item: ItemType,
keys: Array<KeyOption<ItemType>>,
keys: ReadonlyArray<KeyOption<ItemType>>,
) {
const allValues: Array<{itemValue: string; attributes: KeyAttributes}> = []
for (let j = 0, J = keys.length; j < J; j++) {
Expand Down

0 comments on commit 6ce7833

Please sign in to comment.