readline: remove question method from InterfaceConstructor

That method is overwritten in both
`require('node:readline').Interface.prototype` and
`require('node:readline/promises').Interface.prototype`, and is very
much not useful outside of interacting with TTY, removing it from the
parent class could enable the use of `InterfaceConstructor` in other
contexts (such as interacting with files).

PR-URL: https://github.com/nodejs/node/pull/44606
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Antoine du Hamel
2022-09-14 21:10:53 +02:00
committed by GitHub
parent 5ec2c99007
commit 481a959adb
4 changed files with 8 additions and 61 deletions

View File

@@ -10,6 +10,7 @@ const {
const {
Interface: _Interface,
kQuestion,
kQuestionCancel,
} = require('internal/readline/interface');
@@ -49,7 +50,7 @@ class Interface extends _Interface {
};
}
super.question(query, cb);
this[kQuestion](query, cb);
});
}
}