From c1ec00f135d06eae439b3de127408be6dec04770 Mon Sep 17 00:00:00 2001 From: "Gustavo R. 'Gustavo6046' Rehermann" Date: Thu, 1 Nov 2018 11:32:15 -0300 Subject: [PATCH] Fixed ANSI typings. --- types/ansi/ansi-tests.ts | 2 +- types/ansi/index.d.ts | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/types/ansi/ansi-tests.ts b/types/ansi/ansi-tests.ts index 5d8e73e8ec..09d003a563 100644 --- a/types/ansi/ansi-tests.ts +++ b/types/ansi/ansi-tests.ts @@ -20,5 +20,5 @@ Object.keys({ , brightCyan: 96 , brightWhite: 97 }).forEach((color) => { - cursor[color]().bold().write(`Hello, bold ${color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`)} world!\n`).reset(); + (<{ [key: string]: (..._: any[]) => ansi.Cursor }> cursor)[color]().bold().write(`Hello, bold ${color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`)} world!\n`).reset(); }); diff --git a/types/ansi/index.d.ts b/types/ansi/index.d.ts index cd1181b5d9..e050aa7c22 100644 --- a/types/ansi/index.d.ts +++ b/types/ansi/index.d.ts @@ -168,11 +168,13 @@ declare namespace ansi { brightWhite(): Cursor; } - /* Removed index signatures due to conflicts. Now you have to - * add them in consumer code: - * - * <{ [key: string]: (..._: any[]) => Cursor }> myCursorOrColorer; - */ + interface Cursor { + [key: string]: ((...anything: any[]) => Cursor) | Colorer; + } + + interface Colorer { + [key: string]: (...anything: any[]) => (Cursor | Colorer); + } } export = ansi;