Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions types/node/readline.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ declare module "readline" {
class Interface extends events.EventEmitter {
readonly terminal: boolean;

// Need direct access to line/cursor data, for use in external processes
// see: https://github.com/nodejs/node/issues/30347
/** The current input data */
readonly line: string;
/** The current cursor position in the input line */
readonly cursor: number;

/**
* NOTE: According to the documentation:
*
Expand Down
11 changes: 11 additions & 0 deletions types/node/test/readline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ const rl: readline.ReadLine = readline.createInterface(new stream.Readable());
rl.write('asd', key);
}

{
const data: string | Buffer = "test";
rl.line; // $ExpectType string
rl.cursor; // $ExpectType number

rl.write(data);

rl.line; // $ExpectType string
rl.cursor; // $ExpectType number
}

{
const strm: NodeJS.WritableStream = new stream.Writable();
const x = 1;
Expand Down
7 changes: 7 additions & 0 deletions types/node/v10/readline.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ declare module "readline" {
class Interface extends events.EventEmitter {
readonly terminal: boolean;

// Need direct access to line/cursor data, for use in external processes
// see: https://github.com/nodejs/node/issues/30347
/** The current input data */
readonly line: string;
/** The current cursor position in the input line */
readonly cursor: number;

/**
* NOTE: According to the documentation:
*
Expand Down