diff --git a/types/format-number/format-number-tests.ts b/types/format-number/format-number-tests.ts new file mode 100644 index 0000000000..72e3cecdba --- /dev/null +++ b/types/format-number/format-number-tests.ts @@ -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 diff --git a/types/format-number/index.d.ts b/types/format-number/index.d.ts new file mode 100644 index 0000000000..03eafefb45 --- /dev/null +++ b/types/format-number/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for format-number 2.0 +// Project: https://github.com/componitable/format-number +// Definitions by: Fedai Kaya +// 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; diff --git a/types/format-number/tsconfig.json b/types/format-number/tsconfig.json new file mode 100644 index 0000000000..77b1c052ad --- /dev/null +++ b/types/format-number/tsconfig.json @@ -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"] +} diff --git a/types/format-number/tslint.json b/types/format-number/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/format-number/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }