diff --git a/types/autosuggest-highlight/autosuggest-highlight-tests.ts b/types/autosuggest-highlight/autosuggest-highlight-tests.ts new file mode 100644 index 0000000000..50283a24bd --- /dev/null +++ b/types/autosuggest-highlight/autosuggest-highlight-tests.ts @@ -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; }[] +} diff --git a/types/autosuggest-highlight/index.d.ts b/types/autosuggest-highlight/index.d.ts new file mode 100644 index 0000000000..e05c30d608 --- /dev/null +++ b/types/autosuggest-highlight/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for autosuggest-highlight 3.1 +// Project: https://github.com/moroshko/autosuggest-highlight#readme +// Definitions by: Artur Sianiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 diff --git a/types/autosuggest-highlight/match/index.d.ts b/types/autosuggest-highlight/match/index.d.ts new file mode 100644 index 0000000000..19d18c48b3 --- /dev/null +++ b/types/autosuggest-highlight/match/index.d.ts @@ -0,0 +1,3 @@ +declare function match(text: string, query: string): number[] | number[][]; + +export = match; diff --git a/types/autosuggest-highlight/parse/index.d.ts b/types/autosuggest-highlight/parse/index.d.ts new file mode 100644 index 0000000000..01038cd116 --- /dev/null +++ b/types/autosuggest-highlight/parse/index.d.ts @@ -0,0 +1,3 @@ +declare function parse(text: string, matches: number[] | number[][]): Array<{ text: string; highlight: boolean; }>; + +export = parse; diff --git a/types/autosuggest-highlight/tsconfig.json b/types/autosuggest-highlight/tsconfig.json new file mode 100644 index 0000000000..8201d360ec --- /dev/null +++ b/types/autosuggest-highlight/tsconfig.json @@ -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" + ] +} diff --git a/types/autosuggest-highlight/tslint.json b/types/autosuggest-highlight/tslint.json new file mode 100644 index 0000000000..946997cb87 --- /dev/null +++ b/types/autosuggest-highlight/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-useless-files": false + } +}