In the Nodejs docs, I see:
import EventEmitter from 'events';
import { readFile } from 'fs';
import fs, { readFileSync } from 'fs';
https://nodejs.org/api/esm.html
But with "readlines", I see:
const readline = require('readline');
https://nodejs.org/dist/latest-v10.x/docs/api/readline.html
But in StackOverflow, I see:
import * as readline from "readline";
TypeScript + NodeJS readline property missing
But I tried the above and other variations of import
and can't make it work, so I have to use require
. Could someone explain to me why this is the case, since readline
is a default node module?
Thanks.