@@ -1100,8 +1100,8 @@ declare module "punycode" {
1100
1100
}
1101
1101
1102
1102
declare module "repl" {
1103
- import * as stream from "stream " ;
1104
- import * as events from "events " ;
1103
+ import { EventEmitter } from "events " ;
1104
+ import { Interface } from "readline " ;
1105
1105
1106
1106
export interface ReplOptions {
1107
1107
prompt ?: string ;
@@ -1114,12 +1114,26 @@ declare module "repl" {
1114
1114
ignoreUndefined ?: boolean ;
1115
1115
writer ?: Function ;
1116
1116
}
1117
- export function start ( options : ReplOptions ) : events . EventEmitter ;
1117
+
1118
+ export function start ( options : ReplOptions ) : REPLServer ;
1119
+
1120
+ export type REPLCommand = ( this : REPLServer , rest : string ) => void ;
1121
+
1122
+ export class REPLServer extends Interface {
1123
+ inputStream : NodeJS . ReadableStream ;
1124
+ outputStream : NodeJS . WritableStream ;
1125
+ useColors : boolean ;
1126
+ commands : {
1127
+ [ command : string ] : REPLCommand ;
1128
+ } ;
1129
+ defineCommand ( keyword : string , cmd : REPLCommand | { help : string , action : REPLCommand } ) : void ;
1130
+ displayPrompt ( preserveCursor ?: boolean ) : void ;
1131
+ setPrompt ( prompt : string ) : void ;
1132
+ }
1118
1133
}
1119
1134
1120
1135
declare module "readline" {
1121
1136
import * as events from "events" ;
1122
- import * as stream from "stream" ;
1123
1137
1124
1138
export interface Key {
1125
1139
sequence ?: string ;
@@ -1129,14 +1143,14 @@ declare module "readline" {
1129
1143
shift ?: boolean ;
1130
1144
}
1131
1145
1132
- export interface ReadLine extends events . EventEmitter {
1146
+ export class Interface extends events . EventEmitter {
1133
1147
setPrompt ( prompt : string ) : void ;
1134
1148
prompt ( preserveCursor ?: boolean ) : void ;
1135
1149
question ( query : string , callback : ( answer : string ) => void ) : void ;
1136
- pause ( ) : ReadLine ;
1137
- resume ( ) : ReadLine ;
1150
+ pause ( ) : this ;
1151
+ resume ( ) : this ;
1138
1152
close ( ) : void ;
1139
- write ( data : string | Buffer , key ?: Key ) : void ;
1153
+ write ( data : string | Buffer , key ?: Key ) : void ;
1140
1154
}
1141
1155
1142
1156
export interface Completer {
@@ -1149,16 +1163,16 @@ declare module "readline" {
1149
1163
line : string ;
1150
1164
}
1151
1165
1152
- export interface ReadLineOptions {
1166
+ export interface InterfaceOptions {
1153
1167
input : NodeJS . ReadableStream ;
1154
1168
output ?: NodeJS . WritableStream ;
1155
1169
completer ?: Completer ;
1156
1170
terminal ?: boolean ;
1157
1171
historySize ?: number ;
1158
1172
}
1159
1173
1160
- export function createInterface ( input : NodeJS . ReadableStream , output ?: NodeJS . WritableStream , completer ?: Completer , terminal ?: boolean ) : ReadLine ;
1161
- export function createInterface ( options : ReadLineOptions ) : ReadLine ;
1174
+ export function createInterface ( input : NodeJS . ReadableStream , output ?: NodeJS . WritableStream , completer ?: Completer , terminal ?: boolean ) : Interface ;
1175
+ export function createInterface ( options : InterfaceOptions ) : Interface ;
1162
1176
1163
1177
export function cursorTo ( stream : NodeJS . WritableStream , x : number , y : number ) : void ;
1164
1178
export function moveCursor ( stream : NodeJS . WritableStream , dx : number | string , dy : number | string ) : void ;
0 commit comments