Merge pull request #23485 from senukartur/autosuggest-highlight

added definition for autosuggest-highlight
This commit is contained in:
Daniel Rosenwasser
2018-02-15 13:10:44 -08:00
committed by GitHub
6 changed files with 54 additions and 0 deletions
@@ -0,0 +1,11 @@
import match = require('autosuggest-highlight/match');
import parse = require('autosuggest-highlight/parse');
function matchTest() {
let matches = match('some text', 'te'); // $ExpectType number[] | number[][]
matches = match('some sweet text', 's s'); // $ExpectType number[] | number[][]
}
function parseTest() {
const parts = parse('Pretty cool text', [[7, 9], [12, 13]]); // $ExpectType { text: string; highlight: boolean; }[]
}
+5
View File
@@ -0,0 +1,5 @@
// Type definitions for autosuggest-highlight 3.1
// Project: https://github.com/moroshko/autosuggest-highlight#readme
// Definitions by: Artur Sianiuk <https://github.com/senukartur>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+3
View File
@@ -0,0 +1,3 @@
declare function match(text: string, query: string): number[] | number[][];
export = match;
+3
View File
@@ -0,0 +1,3 @@
declare function parse(text: string, matches: number[] | number[][]): Array<{ text: string; highlight: boolean; }>;
export = parse;
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"autosuggest-highlight-tests.ts",
"match/index.d.ts",
"parse/index.d.ts"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-useless-files": false
}
}