[@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
This commit is contained in:
Jérémie Astori
2019-08-14 20:27:25 -04:00
committed by Pranav Senthilnathan
parent 4e846ad5af
commit df430a582d
2 changed files with 2 additions and 1 deletions

View File

@@ -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.
*/

View File

@@ -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
}