How to read line from console synchronously in ts-node
<p>I am working on a <code>node.js</code> application which shows some menu options on console and asks for input (1-5). Application is in <code>tyepscript</code>.</p>

<p>So I can print my menu using <code>console.log()</code>.</p>

<pre><code>console.log('1: Option#1');
console.log('2: Option#2');
console.log('3: Option#3');
console.log('4: Option#4');

// some way to read input from console
var opt = readFromConsole();  // HOW TO READ?

// perform some action on the basis of those options
someAction();
</code></pre>

<p>But how to read from console synchronously in <code>tyepscript</code>?</p>

<p>I found one <code>node.js</code> module <a href="https://www.npmjs.com/package/readline-sync" rel="nofollow noreferrer"><code>readline-sync</code></a>. But it seems to work of <code>node.js</code> applications. My application is totally <code>typescript</code> based. So is there any <code>typescript</code> module which I can use to fullfill my purpose? Or, in any way can I use <a href="https://nodejs.org/api/fs.html" rel="nofollow noreferrer"><code>fs</code></a> for my purpose?</p>

<p>Any kind of help/suggestion is appreciated.</p>