From 2ce437c42668903308fde4bfcc56190af242fcdc Mon Sep 17 00:00:00 2001 From: Claas Ahlrichs Date: Sun, 31 Mar 2019 11:09:20 +0200 Subject: [PATCH] drafted types for repeating --- types/repeating/index.d.ts | 10 ++++++++-- types/repeating/repeating-tests.ts | 7 +++++++ types/repeating/tsconfig.json | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/types/repeating/index.d.ts b/types/repeating/index.d.ts index d65737b6df..4386f38510 100644 --- a/types/repeating/index.d.ts +++ b/types/repeating/index.d.ts @@ -1,9 +1,15 @@ // Type definitions for repeating 3.0 // Project: https://github.com/sindresorhus/repeating#readme -// Definitions by: My Self +// Definitions by: Claas Ahlrichs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = repeating; -declare function repeating(n: any, str: any): any; +/** + * Repeat a string - fast + * + * @param count Times the 'string' should be repeated. + * @param str String to repeat. Default: ' ' + */ +declare function repeating(count: number, str?: string): string; diff --git a/types/repeating/repeating-tests.ts b/types/repeating/repeating-tests.ts index e69de29bb2..d39ea6f826 100644 --- a/types/repeating/repeating-tests.ts +++ b/types/repeating/repeating-tests.ts @@ -0,0 +1,7 @@ +import repeat from "repeating"; + +repeating(5); +//=> ' ' + +repeating(3, 'unicorn '); +//=> 'unicorn unicorn unicorn ' diff --git a/types/repeating/tsconfig.json b/types/repeating/tsconfig.json index b77e31e646..beb83da513 100644 --- a/types/repeating/tsconfig.json +++ b/types/repeating/tsconfig.json @@ -7,13 +7,15 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "files": [ "index.d.ts",