diff --git a/dist/index.d.ts b/dist/index.d.ts index 5cf4165..6790ba1 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -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. * @@ -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; diff --git a/src/index.ts b/src/index.ts index 33be1a7..a4e4134 100644 --- a/src/index.ts +++ b/src/index.ts @@ -61,7 +61,7 @@ export type Options = { */ export function findSimilar( word: string, - candidates: string[], + candidates: readonly string[] | string[], options: Options = {} ) { let { maxScore = 3 } = options @@ -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)