Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
@types/prompts
Advanced tools
@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, and whoaa512.
FAQs
TypeScript definitions for prompts
The npm package @types/prompts receives a total of 0 weekly downloads. As such, @types/prompts popularity was classified as not popular.
We found that @types/prompts demonstrated a healthy version release cadence and project activity because the last version was released less than 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
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.