Add type definition of the module format-number (#34101)

* Add type definition of the module format-number

Add type definition of the module format-number

Amend

Amend

* Add README.md

* Remove unnecessary files

Trigger github devops

Add line at the end of the file

* Remove unnecessary line
This commit is contained in:
Fedail Yusein 2019-03-25 19:48:50 +03:00 committed by timolinn
parent 82ab88b4fd
commit 1c24ca23fc
4 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import createFormatNumber from "format-number";
createFormatNumber({ round: 2 }); // $ExpectType (number: number, overrideOptions?: { noUnits: boolean; noSeparator: boolean; } | undefined) => string
createFormatNumber({ round: 2 })(12); // $ExpectType string

30
types/format-number/index.d.ts vendored Normal file
View File

@ -0,0 +1,30 @@
// Type definitions for format-number 2.0
// Project: https://github.com/componitable/format-number
// Definitions by: Fedai Kaya <https://github.com/codelovesme>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export default function(options?: {
negativeType?: "right" | "left" | "brackets" | null;
negativeLeftSymbol?: string;
negative?: "R" | null;
negativeRightSymbol?: string;
negativeLeftOut?: boolean;
negativeOut?: boolean;
prefix?: string;
suffix?: string;
integerSeparator?: string;
separator?: string;
decimalsSeparator?: string;
decimal?: string;
padLeft?: number;
padRight?: number;
round?: number;
truncate?: number;
allowedSeparators?: string[];
}): (
number: number,
overrideOptions?: {
noUnits: boolean;
noSeparator: boolean;
}
) => string;

View File

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

View File

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