Skip to content

Commit

Permalink
feat(types): accepts readonly string[] for candidates param
Browse files Browse the repository at this point in the history
  • Loading branch information
bent10 committed Apr 29, 2022
1 parent 77afb0b commit 9b31503
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export declare type Options = {
* @param options - Options for the function.
* @returns An array of similar words.
*/
export declare function findSimilar(word: string, candidates: string[], options?: Options): string[];
export declare function findSimilar(word: string, candidates: readonly string[] | string[], options?: Options): string[];
/**
* Suggests similar words in a list of words.
*
Expand All @@ -62,4 +62,4 @@ export declare function findSimilar(word: string, candidates: string[], options?
* @param options - Options for the function.
* @returns A string of suggested words.
*/
export declare function didYouMean(word: string, candidates: string[], options?: Options): string;
export declare function didYouMean(word: string, candidates: readonly string[] | string[], options?: Options): string;
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export type Options = {
*/
export function findSimilar(
word: string,
candidates: string[],
candidates: readonly string[] | string[],
options: Options = {}
) {
let { maxScore = 3 } = options
Expand Down Expand Up @@ -96,7 +96,7 @@ export function findSimilar(
*/
export function didYouMean(
word: string,
candidates: string[],
candidates: readonly string[] | string[],
options: Options = {}
) {
const matches = findSimilar(word, candidates, options)
Expand Down

0 comments on commit 9b31503

Please sign in to comment.