Fix type definition for REPL module of Node.js (#18021)

* Fix signature for repl.start() function

* Complete type definition for REPLServer.context property
This commit is contained in:
Ryota Kameoka
2017-07-18 04:25:30 +09:00
committed by Andy
parent 425cbe9fd8
commit da17482087
5 changed files with 7 additions and 5 deletions

View File

@@ -1593,6 +1593,7 @@ declare module "repl" {
}
export interface REPLServer extends readline.ReadLine {
context: any;
defineCommand(keyword: string, cmd: Function | { help: string, action: Function }): void;
displayPrompt(preserveCursor?: boolean): void;
@@ -1627,7 +1628,7 @@ declare module "repl" {
prependOnceListener(event: "reset", listener: (...args: any[]) => void): this;
}
export function start(options: ReplOptions): REPLServer;
export function start(options?: string | ReplOptions): REPLServer;
}
declare module "readline" {

View File

@@ -810,7 +810,7 @@ declare module "repl" {
ignoreUndefined?: boolean;
writer?: Function;
}
export function start(options: ReplOptions): events.EventEmitter;
export function start(options?: string | ReplOptions): events.EventEmitter;
}
declare module "readline" {

View File

@@ -972,7 +972,7 @@ declare module "repl" {
ignoreUndefined?: boolean;
writer?: Function;
}
export function start(options: ReplOptions): events.EventEmitter;
export function start(options?: string | ReplOptions): events.EventEmitter;
}
declare module "readline" {

View File

@@ -1420,7 +1420,7 @@ declare module "repl" {
prependOnceListener(event: "reset", listener: Function): this;
}
export function start(options: ReplOptions): REPLServer;
export function start(options?: string | ReplOptions): REPLServer;
}
declare module "readline" {

View File

@@ -1448,6 +1448,7 @@ declare module "repl" {
}
export interface REPLServer extends readline.ReadLine {
context: any;
defineCommand(keyword: string, cmd: Function | { help: string, action: Function }): void;
displayPrompt(preserveCursor?: boolean): void;
@@ -1482,7 +1483,7 @@ declare module "repl" {
prependOnceListener(event: "reset", listener: Function): this;
}
export function start(options: ReplOptions): REPLServer;
export function start(options?: string | ReplOptions): REPLServer;
}
declare module "readline" {