mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
[abbrev] add typings
This commit is contained in:
13
types/abbrev/abbrev-tests.ts
Normal file
13
types/abbrev/abbrev-tests.ts
Normal 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
27
types/abbrev/index.d.ts
vendored
Normal 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};
|
||||
}
|
||||
}
|
||||
22
types/abbrev/tsconfig.json
Normal file
22
types/abbrev/tsconfig.json
Normal 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
1
types/abbrev/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user