From df430a582df383836df5b2f2f1fa4b3bb4e5de0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Wed, 14 Aug 2019 20:27:25 -0400 Subject: [PATCH] [@types/node] Fix `cursorTo` requiring a `y` parameter (#37630) * Fix `cursorTo` requiring a `y` parameter When `y` is omitted, `cursorTo` moves the cursor to the first character of the current line. When `y` is required, there is no way to use this capability of `cursorTo`. * Re-add `cursorTo` test when not passing down `y` parameter --- types/node/readline.d.ts | 2 +- types/node/test/readline.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/node/readline.d.ts b/types/node/readline.d.ts index 77149d3f11..ed47fefeda 100644 --- a/types/node/readline.d.ts +++ b/types/node/readline.d.ts @@ -142,7 +142,7 @@ declare module "readline" { /** * Moves this WriteStream's cursor to the specified position. */ - function cursorTo(stream: NodeJS.WritableStream, x: number, y: number, callback?: () => void): boolean; + function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; /** * Moves this WriteStream's cursor relative to its current position. */ diff --git a/types/node/test/readline.ts b/types/node/test/readline.ts index 8dfd5a9c1d..36884df6f3 100644 --- a/types/node/test/readline.ts +++ b/types/node/test/readline.ts @@ -76,6 +76,7 @@ const rl: readline.ReadLine = readline.createInterface(new stream.Readable()); const x = 1; const y = 1; + readline.cursorTo(strm, x); readline.cursorTo(strm, x, y); readline.cursorTo(strm, x, y, () => {}); // $ExpectType boolean }