mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Fix natural DamerauLevenshteinDistance optional options (#41159)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
4e6bf5b5f4
commit
0cb6d12fac
Vendored
+2
-2
@@ -53,7 +53,7 @@ interface SubstringDistanceResult {
|
||||
substring: string;
|
||||
distance: number;
|
||||
}
|
||||
/*
|
||||
/**
|
||||
* Returns the Damerau-Levenshtein distance between strings. Counts the distance
|
||||
* between two strings by returning the number of edit operations required to
|
||||
* convert `source` into `target`.
|
||||
@@ -69,7 +69,7 @@ export function DamerauLevenshteinDistance(
|
||||
export function DamerauLevenshteinDistance(
|
||||
source: string,
|
||||
target: string,
|
||||
options: DamerauLevenshteinDistanceOptions & { search?: false }
|
||||
options?: DamerauLevenshteinDistanceOptions & { search?: false }
|
||||
): number;
|
||||
export function DamerauLevenshteinDistance(
|
||||
source: string,
|
||||
|
||||
@@ -32,6 +32,8 @@ console.log(natural.LevenshteinDistance("ones","onez", {
|
||||
natural.DamerauLevenshteinDistance("ones","onez", { search: true });
|
||||
// $ExpectType number
|
||||
natural.DamerauLevenshteinDistance("ones","onez", { search: false });
|
||||
// $ExpectType number
|
||||
natural.DamerauLevenshteinDistance("ones","onez");
|
||||
// $ExpectType number | SubstringDistanceResult
|
||||
natural.DamerauLevenshteinDistance("ones","onez", { search: Math.random() > 0.5 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user