Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
@types/prompts
Advanced tools
TypeScript definitions for prompts
@types/prompts provides TypeScript type definitions for the 'prompts' library, which is used to create interactive command-line prompts.
Basic Text Prompt
This feature allows you to create a basic text prompt where the user can input a string. The example asks for the user's name and then greets them.
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'text',
name: 'value',
message: 'What is your name?'
});
console.log(`Hello, ${response.value}!`);
})();
Select Prompt
This feature allows you to create a select prompt where the user can choose from a list of options. The example lets the user pick a color from a list.
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'select',
name: 'color',
message: 'Pick a color',
choices: [
{ title: 'Red', value: 'red' },
{ title: 'Green', value: 'green' },
{ title: 'Blue', value: 'blue' }
],
initial: 1
});
console.log(`You chose: ${response.color}`);
})();
Confirm Prompt
This feature allows you to create a confirm prompt where the user can answer with a yes or no. The example asks if the user wants to continue and logs the response.
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'confirm',
name: 'value',
message: 'Do you want to continue?'
});
console.log(response.value ? 'Continuing...' : 'Aborted');
})();
Inquirer.js is a collection of common interactive command-line user interfaces. It provides similar functionalities to 'prompts' but with a more extensive set of features and customization options.
Enquirer is a stylish, intuitive, and user-friendly prompt system for Node.js. It offers similar functionalities to 'prompts' but focuses more on customization and user experience.
Vorpal is a framework for building interactive CLI applications. It provides similar prompt functionalities but also includes features for building more complex command-line interfaces.
npm install --save @types/prompts
This package contains type definitions for prompts (https://github.com/terkelg/prompts).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prompts.
These definitions were written by Berkay GURSOY, Daniel Perez Alvarez, Kamontat Chantrachirathumrong, theweirdone, whoaa512, John Reilly, and Christopher Hiller.
FAQs
TypeScript definitions for prompts
The npm package @types/prompts receives a total of 405,025 weekly downloads. As such, @types/prompts popularity was classified as popular.
We found that @types/prompts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.