[abbrev] add typings

This commit is contained in:
Dimitri Benin
2017-08-22 10:22:14 +02:00
parent cf0172024a
commit 38380f8f63
4 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import abbrev = require('abbrev');
let abbrs: { [abbreviation: string]: string; };
abbrs = abbrev();
abbrs = abbrev('foo', 'fool', 'folding', 'flop');
abbrs = abbrev(['foo', 'fool', 'folding', 'flop']);
abbrev.monkeyPatch();
abbrs = [].abbrev();
const roArr: ReadonlyArray<string> = [];
abbrs = roArr.abbrev();
abbrs = ({}).abbrev();

27
types/abbrev/index.d.ts vendored Normal file
View File

@@ -0,0 +1,27 @@
// Type definitions for abbrev 1.1
// Project: https://github.com/isaacs/abbrev-js#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = abbrev;
declare function abbrev(words: string[]): {[abbreviation: string]: string};
declare function abbrev(...words: string[]): {[abbreviation: string]: string};
declare namespace abbrev {
function monkeyPatch(): void;
}
declare global {
interface Array<T> {
abbrev(): {[abbreviation: string]: string};
}
interface ReadonlyArray<T> {
abbrev(): {[abbreviation: string]: string};
}
interface Object {
abbrev(): {[abbreviation: string]: string};
}
}

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"abbrev-tests.ts"
]
}

1
types/abbrev/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }