I use prompt-sync
module in my Node project.
const prompt = require('prompt-sync')();
const result = prompt(message);
But to keep my TypeScript code consistent I need to use import
instead of require
.
So I installed types for the package.
npm i @types/prompt-sync
And I tried to use it like
import * as promptSync from 'prompt-sync';
...
const prompt = promptSync();
const result = prompt(message);
But the error appeared
Error:(24, 20) TS2349: This expression is not callable.
Type '{ default: (config?: Config | undefined) => Prompt; }' has no call signatures.
So how can I use prompt-sync with import
?