# typed-prompts

> Well typed interactive command line prompts

Latest version **1.5.0** (published 2016-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install typed-prompts
pnpm add typed-prompts
yarn add typed-prompts
bun add typed-prompts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2016-12-21 |
| First published | 2016-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Tylor Steinberger |
| Maintainers | tylors |
| Keywords | typescript |

## Links

- npm: https://www.npmjs.com/package/typed-prompts
- Repository: https://github.com/TylorS/typed-prompts
- Homepage: https://github.com/TylorS/typed-prompts#readme
- Issues: https://github.com/TylorS/typed-prompts/issues
- npm.io page: https://npm.io/package/typed-prompts

## Dependencies (1)

- [inquirer](https://npm.io/package/inquirer.md) ^1.2.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.5.0 (latest) — 2016-12-21
- 1.4.0 — 2016-11-28
- 1.3.0 — 2016-11-28
- 1.2.0 — 2016-11-28
- 1.1.0 — 2016-11-27
- 1.0.0 — 2016-11-08

## README

# Typed Prompts

Well-Typed, written in TypeScript, interactive terminal prompts.

This is really just a typed wrapper around the robust library
[inquirer](https://github.com/SBoudrias/Inquirer.js/) with
typings for a TypeScript user like myself. If you don't care for the typings I'd
suggest using inquirer directly.

# Get it

```sh
npm install --save typed-prompts
```

# Basic Usage

```typescript
import { prompt, list } from 'typed-prompts'

interface Answers {
  whatsUp: string;
}

prompt<Answers>([
  list('whatsUp', 'What is up?', [
    'the sky',
    'the stars',
    'the ceiling'
  ])
])
.then((answers) => {
  console.log(answers.whatsUp); // 'the sky'
})
```

# API

#### `prompt<T>(questions: Array<Question>, options?: { stdout: WritableStream, stdin: ReadableStream }): Promise<T>;`

This is the main function exposed by this library. It is responsible for asking your questions.

#### `separator(): Separator`

This creates a separator object to place boundaries in a list of choices for ListQuestion RawListQuestion and CheckboxQuestion.

---
## Convenience Functions

#### `checkbox(name, message, choices[, options]): CheckboxQuestion`
#### `confirm(name, message[, options]): ConfirmQuestion`
#### `editor(name, message, [, options]): EditorQuestion`
#### `expand(name, message, choices[, options]): ExpandQuestion`
#### `input(name, message[, options]): InputQuestion`
#### `list(name, message, choices[, options]): ListQuestion`
#### `password(name, message[, options]): PasswordQuestion`
#### `rawList(name, message, choices[, options]): RawListQuestion`

There are convenience functions `checkbox`, `confirm`, `editor`, `expand`, `input`,
`list`, `password`, and `rawList` to create its corresponding Question object.
Honestly, I'm being a bit lazy at the moment and won't document them to their fullest
just yet because this README would end up large and cluttered with types.
If you're not using TypeScript, I'd suggest still reading the inquirer.js docs and
using it directly, but if you're using TypeScript you'll have great autocompletion
for the type required by each convenience function.

---
_Source: https://npm.io/package/typed-prompts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
