Add fast-levenshtein type definition (#11647)

This commit is contained in:
Mizunashi Mana
2016-10-04 06:40:19 +09:00
committed by Mohamed Hegazy
parent d3b7ecb1fb
commit 82ed03dce3
3 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import * as fastLevenshtein from 'fast-levenshtein';
declare const boolVal: boolean;
declare const strVal: string;
// option datas tests
let opts: fastLevenshtein.LevenshteinOptions = {};
opts.useCollator = boolVal;
// API tests
fastLevenshtein.get(strVal, strVal);
fastLevenshtein.get(strVal, strVal, opts);

10
fast-levenshtein/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Type definitions for fast-levenshtein
// Project: https://github.com/hiddentao/fast-levenshtein
// Definitions by: Mizunashi Mana <https://github.com/mizunashi-mana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface LevenshteinOptions {
useCollator?: boolean;
}
export function get(str1: string, str2: string, opts?: LevenshteinOptions): number;

View File

@@ -0,0 +1,19 @@
{
"files": [
"index.d.ts",
"fast-levenshtein-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}