Add typings for indefinite

This commit is contained in:
Ohad Maishar 2019-02-19 21:30:58 +02:00
parent 767a63a86d
commit 10e9b1cf8b
4 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import indefinite from "indefinite";
const anApple = indefinite("apple"); // "an apple"
const aBanana = indefinite('banana'); // "a banana"
const AnApple = indefinite('apple', { capitalize: true }); // "An apple"
const anEight = indefinite("8"); // "an 8"
const anEightAsNumber = indefinite(8); // "an 8"
const a1892 = indefinite("1892"); // "a 1892" -> read "a one thousand eight hundred ninety-two"
const a1892AsColloquial = indefinite("1892", { numbers: "colloquial" }); // "an 1892" -> read "an eighteen ninety-two"

14
types/indefinite/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
// Type definitions for indefinite 2.2
// Project: https://github.com/tandrewnichols/indefinite
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "indefinite" {
interface Options {
capitalize?: boolean;
caseInsensitive?: boolean;
numbers?: "colloquial";
}
export default function(word: string | number, opts?: Options): 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",
"indefinite-tests.ts"
]
}

View File

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