Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/inquirer

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/inquirer - npm Package Compare versions

Comparing version 8.2.1 to 9.0.0

1378

inquirer/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for inquirer 8.2
// Type definitions for inquirer 9.0
// Project: https://github.com/SBoudrias/Inquirer.js

@@ -18,15 +18,19 @@ // Definitions by: Qubo <https://github.com/tkQubo>

import { Observable } from 'rxjs';
import Choice = require('./lib/objects/choice');
import Choices = require('./lib/objects/choices');
import Separator = require('./lib/objects/separator');
import { ThroughStream } from 'through';
import Choice from './lib/objects/choice';
import Choices from './lib/objects/choices';
import Separator from './lib/objects/separator';
import './lib/prompts/base';
import './lib/prompts/checkbox';
import './lib/prompts/confirm';
import './lib/prompts/editor';
import './lib/prompts/expand';
import './lib/prompts/input';
import './lib/prompts/list';
import './lib/prompts/number';
import './lib/prompts/password';
import './lib/prompts/rawlist';
import CheckboxPrompt from './lib/prompts/checkbox';
import ConfirmPrompt from './lib/prompts/confirm';
import EditorPrompt from './lib/prompts/editor';
import ExpandPrompt from './lib/prompts/expand';
import InputPrompt from './lib/prompts/input';
import ListPrompt from './lib/prompts/list';
import NumberPrompt from './lib/prompts/number';
import PasswordPrompt from './lib/prompts/password';
import RawListPrompt from './lib/prompts/rawlist';
import UI from './lib/ui/baseUI';
import './lib/ui/bottom-bar';
import './lib/ui/prompt';
import './lib/utils/events';

@@ -36,5 +40,2 @@ import './lib/utils/paginator';

import './lib/utils/screen-manager';
import './lib/utils/utils';
import BottomBar = require('./lib/ui/bottom-bar');
import PromptUI = require('./lib/ui/prompt');

@@ -74,2 +75,12 @@ /**

/**
* Represents a function for registering a prompt.
*/
type RegisterFunction = PromptModuleBase['registerPrompt'];
/**
* Represents a function for restoring a prompt.
*/
type RestoreFunction = PromptModuleBase['restoreDefaultPrompts'];
/**
* Represents a list-based question.

@@ -83,7 +94,7 @@ *

*/
interface ListQuestionOptionsBase<T extends inquirer.Answers, TChoiceMap extends inquirer.Answers> extends inquirer.Question<T> {
interface ListQuestionOptionsBase<T extends Answers, TChoiceMap> extends Question<T> {
/**
* The choices of the prompt.
*/
choices?: inquirer.AsyncDynamicQuestionProperty<ReadonlyArray<inquirer.DistinctChoice<TChoiceMap>>, T> | undefined;
choices?: AsyncDynamicQuestionProperty<ReadonlyArray<DistinctChoice<T, TChoiceMap>>, T> | undefined;

@@ -97,722 +108,690 @@ /**

/**
* Provides components for the module.
* Creates a prompt-module.
*
* @param opt
* The streams for the prompt-module.
*
* @returns
* The new prompt-module.
*/
declare namespace inquirer {
/**
* Represents either a key of `T` or a `string`.
*
* @template T
* The type of the keys to suggest.
*/
type KeyUnion<T> = LiteralUnion<Extract<keyof T, string>>;
export function createPromptModule(opt?: StreamOptions): PromptModule;
/**
* Converts the specified union-type `U` to an intersection-type.
*
* @template U
* The union to convert to an intersection.
*/
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
/**
* A component for creating {@link PromptModule `PromptModule`}s.
*/
type PromptModuleCreator = typeof createPromptModule;
/**
* Provides an input and an output-stream.
*/
interface StreamOptions {
/**
* A stream to read the input from.
*/
input?: NodeJS.ReadStream | undefined;
/**
* Represents either a key of {@link T `T`} or a {@link String `string`}.
*
* @template T
* The type of the keys to suggest.
*/
export type KeyUnion<T> = LiteralUnion<Extract<keyof T, string>>;
/**
* A stream to write the output to.
*/
output?: NodeJS.WriteStream | undefined;
}
/**
* Converts the specified union-type {@link U `U`} to an intersection-type.
*
* @template U
* The union to convert to an intersection.
*/
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
/**
* Provides the functionality to prompt questions to the user.
*/
interface PromptModule extends PromptModuleBase {
/**
* The prompts of the prompt-module.
*/
prompts: prompts.PromptCollection;
/**
* A set of answers.
*/
export interface Answers extends Record<string, any> { }
/**
* Prompts the questions to the user.
*/
<T extends Answers = Answers>(questions: QuestionCollection<T>, initialAnswers?: Partial<T>): Promise<T> & { ui: PromptUI<T> };
/**
* Provides the functionality to validate answers.
*
* @template T
* The type of the answers.
*/
export type Validator<T extends Answers = Answers> = Question<T>['validate'];
/**
* Registers a new prompt-type.
*
* @param name
* The name of the prompt.
*
* @param prompt
* The constructor of the prompt.
*/
registerPrompt(name: string, prompt: prompts.PromptConstructor): this;
}
/**
* Provides the functionality to transform an answer.
*
* @template T
* The type of the answers.
*/
export type Transformer<T extends Answers = Answers> = InputQuestionOptions<T>['transformer'];
interface Inquirer extends PromptModuleBase {
/**
* Registers a new prompt-type.
*
* @param name
* The name of the prompt.
*
* @param prompt
* The constructor of the prompt.
*/
registerPrompt(name: string, prompt: prompts.PromptConstructor): void;
/**
* Represents a dynamic property for a question.
*
* @template T
* The type of the property.
*
* @template TAnswers
* The type of the answers.
*/
export type DynamicQuestionProperty<T, TAnswers extends Answers = Answers> = T | ((answers: TAnswers) => T);
/**
* Creates a prompt-module.
*
* @param opt
* The streams for the prompt-module.
*
* @returns
* The new prompt-module.
*/
createPromptModule(opt?: StreamOptions): PromptModule;
/**
* Represents a dynamic property for a question which can be fetched asynchronously.
*
* @template T
* The type of the property.
*
* @template TAnswers
* The type of the answers.
*/
export type AsyncDynamicQuestionProperty<T, TAnswers extends Answers = Answers> = DynamicQuestionProperty<
T | Promise<T>,
TAnswers
>;
/**
* The default prompt-module.
*/
prompt: PromptModule;
/**
* Represents a choice-item.
*/
export interface ChoiceBase {
/**
* The type of the choice.
*/
type?: string | undefined;
}
/**
* The prompts of the default prompt-module.
*
* @deprecated
*/
prompts: {};
/**
* Provides options for a choice of the {@link ListPrompt `ListPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ListChoiceOptions<T extends Answers = Answers> extends ChoiceOptions {
/**
* A value indicating whether the choice is disabled.
*/
disabled?: DynamicQuestionProperty<boolean | string, T> | undefined;
}
/**
* Represents a choice-item separator.
*/
Separator: typeof Separator;
/**
* Provides options for a choice of the {@link CheckboxPrompt `CheckboxPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface CheckboxChoiceOptions<T extends Answers = Answers> extends ListChoiceOptions<T> {
/**
* A value indicating whether the choice should be initially checked.
*/
checked?: boolean | undefined;
}
/**
* Provides ui-components.
*/
ui: {
/**
* Represents the bottom-bar UI.
*/
BottomBar: typeof BottomBar;
/**
* Provides options for a choice of the {@link ExpandPrompt `ExpandPrompt<TQuestion>`}.
*/
export interface ExpandChoiceOptions extends ChoiceOptions {
/**
* The key to press for selecting the choice.
*/
key?: string | undefined;
}
/**
* Represents the prompt ui.
*/
Prompt: typeof PromptUI;
};
}
/**
* Represents a separator.
*/
export interface SeparatorOptions extends ChoiceBase {
/**
* Gets the type of the choice.
*/
type: 'separator';
/**
* A set of answers.
* Gets or sets the text of the separator.
*/
interface Answers extends Record<string, any> {}
line?: string | undefined;
}
/**
* Provides options for a choice.
*/
export interface ChoiceOptions extends ChoiceBase {
/**
* Provides the functionality to validate answers.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
type Validator<T extends Answers = Answers> = Question<T>['validate'];
type?: 'choice' | undefined;
/**
* Provides the functionality to transform an answer.
*
* @template T
* The type of the answers.
* The name of the choice to show to the user.
*/
type Transformer<T extends Answers = Answers> = InputQuestionOptions<T>['transformer'];
name?: string | undefined;
/**
* Represents a dynamic property for a question.
*
* @template T
* The type of the property.
*
* @template TAnswers
* The type of the answers.
* The value of the choice.
*/
type DynamicQuestionProperty<T, TAnswers extends Answers = Answers> = T | ((answers: TAnswers) => T);
value?: any;
/**
* Represents a dynamic property for a question which can be fetched asynchronously.
*
* @template T
* The type of the property.
*
* @template TAnswers
* The type of the answers.
* The short form of the name of the choice.
*/
type AsyncDynamicQuestionProperty<T, TAnswers extends Answers = Answers> = DynamicQuestionProperty<
T | Promise<T>,
TAnswers
>;
short?: string | undefined;
/**
* Provides options for a question.
*
* @template T
* The type of the answers.
* The extra properties of the choice.
*/
interface Question<T extends Answers = Answers> {
/**
* The type of the question.
*/
type?: string | undefined;
extra?: any;
}
/**
* The key to save the answer to the answers-hash.
*/
name?: KeyUnion<T> | undefined;
/**
* Provides all valid choice-types for any kind of question.
*
* @template T
* The type of the answers.
*/
export interface BaseChoiceMap<T extends Answers = Answers> {
Choice: Choice<T>;
ChoiceOptions: ChoiceOptions;
Separator: Separator;
SeparatorOptions: SeparatorOptions;
}
/**
* The message to show to the user.
*/
message?: AsyncDynamicQuestionProperty<string, T> | undefined;
/**
* Provides all valid choice-types for the {@link ListQuestion `ListQuestion<T>`}.
*
* @template T
* The type of the answers.
*/
export interface ListChoiceMap<T extends Answers = Answers> extends BaseChoiceMap<T> {
ListChoiceOptions: ListChoiceOptions<T>;
}
/**
* The default value of the question.
*/
default?: AsyncDynamicQuestionProperty<any, T> | undefined;
/**
* Provides all valid choice-types for the {@link CheckboxQuestion `CheckboxQuestion<T>`}.
*
* @template T
* The type of the answers.
*/
export interface CheckboxChoiceMap<T extends Answers = Answers> extends BaseChoiceMap<T> {
CheckboxChoiceOptions: CheckboxChoiceOptions<T>;
}
/**
* The prefix of the `message`.
*/
prefix?: string | undefined;
/**
* Provides all valid choice-types for the {@link ExpandQuestion `ExpandQuestion<T>`}.
*
* @template T
* The type of the answers.
*/
export interface ExpandChoiceMap<T extends Answers = Answers> extends BaseChoiceMap<T> {
ExpandChoiceOptions: ExpandChoiceOptions;
}
/**
* The suffix of the `message`.
*/
suffix?: string | undefined;
/**
* Provides all valid choice-types.
*
* @template T
* The type of the answers.
*/
export interface AllChoiceMap<T extends Answers = Answers> {
BaseChoiceMap: BaseChoiceMap<T>[keyof BaseChoiceMap<T>];
ListChoiceMap: ListChoiceMap<T>[keyof ListChoiceMap<T>];
CheckboxChoiceMap: CheckboxChoiceMap<T>[keyof CheckboxChoiceMap<T>];
ExpandChoiceMap: ExpandChoiceMap<T>[keyof ExpandChoiceMap<T>];
}
/**
* Post-processes the answer.
*
* @param input
* The answer provided by the user.
*
* @param answers
* The answers provided by the user.
*/
filter?(input: any, answers: T): any;
/**
* Provides valid choices for the question of the {@link TChoiceMap `TChoiceMap`}.
*
* @template TAnswers
* The type of the answers.
*
* @template TChoiceMap
* The choice-types to provide.
*/
export type DistinctChoice<TAnswers extends Answers = Answers, TChoiceMap = AllChoiceMap<TAnswers>> =
| string
| TChoiceMap[keyof TChoiceMap];
/**
* A value indicating whether the question should be prompted.
*/
when?: AsyncDynamicQuestionProperty<boolean, T> | undefined;
/**
* Represents a set of choices.
*
* @template T
* The type of the answers.
*/
export type ChoiceCollection<T extends Answers = Answers> = Array<DistinctChoice<T, AllChoiceMap<T>>>;
/**
* Validates the integrity of the answer.
*
* @param input
* The answer provided by the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* Either a value indicating whether the answer is valid or a `string` which describes the error.
*/
validate?(input: any, answers?: T): boolean | string | Promise<boolean | string>;
/**
* Force to prompt the question if the answer already exists.
*/
askAnswered?: boolean;
}
/**
* Provides options for a question.
*
* @template T
* The type of the answers.
*/
export interface Question<T extends Answers = Answers> {
/**
* Represents the possible answers of each question in the prompt
* The type of the question.
*/
type QuestionAnswer<T extends Answers = Answers> = {
[K in keyof T]: {
name: K;
answer: T[K]
}
}[keyof T];
type?: string | undefined;
/**
* Represents a choice-item.
* The key to save the answer to the answers-hash.
*/
interface ChoiceBase {
/**
* The type of the choice.
*/
type?: string | undefined;
}
name?: KeyUnion<T> | undefined;
/**
* Provides options for a choice.
* The message to show to the user.
*/
interface ChoiceOptions extends ChoiceBase {
/**
* @inheritdoc
*/
type?: 'choice' | undefined;
message?: AsyncDynamicQuestionProperty<string, T> | undefined;
/**
* The name of the choice to show to the user.
*/
name?: string | undefined;
/**
* The value of the choice.
*/
value?: any;
/**
* The short form of the name of the choice.
*/
short?: string | undefined;
/**
* The extra properties of the choice.
*/
extra?: any;
}
/**
* Provides options for a choice of the `ListPrompt`.
*
* @template T
* The type of the answers.
* The default value of the question.
*/
interface ListChoiceOptions<T extends Answers = Answers> extends ChoiceOptions {
/**
* A value indicating whether the choice is disabled.
*/
disabled?: DynamicQuestionProperty<boolean | string, T> | undefined;
}
default?: AsyncDynamicQuestionProperty<any, T> | undefined;
/**
* Provides options for a choice of the `CheckboxPrompt`.
*
* @template T
* The type of the answers.
* The prefix of the {@link message `message`}.
*/
interface CheckboxChoiceOptions<T extends Answers = Answers> extends ListChoiceOptions<T> {
/**
* A value indicating whether the choice should be initially checked.
*/
checked?: boolean | undefined;
}
prefix?: string | undefined;
/**
* Provides options for a choice of the `ExpandPrompt`.
* The suffix of the {@link message `message`}.
*/
interface ExpandChoiceOptions extends ChoiceOptions {
/**
* The key to press for selecting the choice.
*/
key?: string | undefined;
}
suffix?: string | undefined;
/**
* Represents a separator.
*/
interface SeparatorOptions extends ChoiceBase {
/**
* Gets the type of the choice.
*/
type: 'separator';
/**
* Gets or sets the text of the separator.
*/
line?: string | undefined;
}
/**
* Provides all valid choice-types for any kind of question.
* Post-processes the answer.
*
* @template T
* The type of the answers.
* @param input
* The answer provided by the user.
*
* @param answers
* The answers provided by the user.
*/
interface BaseChoiceMap<T extends Answers = Answers> {
Choice: Choice<T>;
ChoiceOptions: ChoiceOptions;
SeparatorOptions: SeparatorOptions;
Separator: Separator;
}
filter?(input: any, answers: T): any;
/**
* Provides all valid choice-types for the `ListQuestion`.
*
* @template T
* The type of the answers.
* A value indicating whether the question should be prompted.
*/
interface ListChoiceMap<T extends Answers = Answers> extends BaseChoiceMap<T> {
ListChoiceOptions: ListChoiceOptions<T>;
}
when?: AsyncDynamicQuestionProperty<boolean, T> | undefined;
/**
* Provides all valid choice-types for the `CheckboxQuestion`.
* Validates the integrity of the answer.
*
* @template T
* The type of the answers.
* @param input
* The answer provided by the user.
*
* @param answers
* The answers provided by the user.
*
* @returns
* Either a value indicating whether the answer is valid or a {@link String `string`} which describes the error.
*/
interface CheckboxChoiceMap<T extends Answers = Answers> extends BaseChoiceMap<T> {
CheckboxChoiceOptions: CheckboxChoiceOptions<T>;
}
validate?(input: any, answers?: T): boolean | string | Promise<boolean | string>;
/**
* Provides all valid choice-types for the `ExpandQuestion`.
*
* @template T
* The type of the answers.
* Force to prompt the question if the answer already exists.
*/
interface ExpandChoiceMap<T extends Answers = Answers> extends BaseChoiceMap<T> {
ExpandChoiceOptions: ExpandChoiceOptions;
}
askAnswered?: boolean;
}
/**
* Provides all valid choice-types.
*
* @template T
* The type of the answers.
*/
interface AllChoiceMap<T extends Answers = Answers> {
BaseChoiceMap: BaseChoiceMap<T>[keyof BaseChoiceMap<T>];
ListChoiceMap: ListChoiceMap<T>[keyof ListChoiceMap<T>];
CheckboxChoiceMap: CheckboxChoiceMap<T>[keyof CheckboxChoiceMap<T>];
ExpandChoiceMap: ExpandChoiceMap<T>[keyof ExpandChoiceMap<T>];
/**
* Represents the possible answers of each question in the prompt
*/
export type QuestionAnswer<T extends Answers = Answers> = {
[K in keyof T]: {
name: K;
answer: T[K]
}
}[keyof T];
/**
* Provides options for a question for the {@link InputPrompt `InputPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface InputQuestionOptions<T extends Answers = Answers> extends Question<T> {
/**
* Provides valid choices for the question of the `TChoiceMap`.
* Transforms the value to display to the user.
*
* @template TAnswers
* The type of the answers.
* @param input
* The input provided by the user.
*
* @template TChoiceMap
* The choice-types to provide.
* @param answers
* The answers provided by the users.
*
* @param flags
* Additional information about the value.
*
* @returns
* The value to display to the user.
*/
type DistinctChoice<TAnswers extends Answers = Answers, TChoiceMap = AllChoiceMap<TAnswers>> =
| string
| TChoiceMap[keyof TChoiceMap];
transformer?(input: any, answers: T, flags: { isFinal?: boolean | undefined }): string | Promise<string>;
}
/**
* Provides options for a question for the {@link InputPrompt `InputPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface InputQuestion<T extends Answers = Answers> extends InputQuestionOptions<T> {
/**
* Represents a set of choices.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
type ChoiceCollection<T extends Answers = Answers> = Array<DistinctChoice<AllChoiceMap<T>>>;
type?: 'input' | undefined;
}
/**
* Provides options for a question for the {@link NumberPrompt `NumberPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface NumberQuestionOptions<T extends Answers = Answers> extends InputQuestionOptions<T> { }
/**
* Provides options for a question for the {@link NumberPrompt `NumberPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface NumberQuestion<T extends Answers = Answers> extends NumberQuestionOptions<T> {
/**
* Provides options for a question for the `InputPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface InputQuestionOptions<T extends Answers = Answers> extends Question<T> {
/**
* Transforms the value to display to the user.
*
* @param input
* The input provided by the user.
*
* @param answers
* The answers provided by the users.
*
* @param flags
* Additional information about the value.
*
* @returns
* The value to display to the user.
*/
transformer?(input: any, answers: T, flags: { isFinal?: boolean | undefined }): string | Promise<string>;
}
type: 'number';
}
/**
* Provides options for a question for the {@link PasswordPrompt `PasswordPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface PasswordQuestionOptions<T extends Answers = Answers> extends InputQuestionOptions<T> {
/**
* Provides options for a question for the `InputPrompt`.
*
* @template T
* The type of the answers.
* The character to replace the user-input.
*/
interface InputQuestion<T extends Answers = Answers> extends InputQuestionOptions<T> {
/**
* @inheritdoc
*/
type?: 'input' | undefined;
}
mask?: string | undefined;
}
/**
* Provides options for a question for the {@link PasswordPrompt `PasswordPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface PasswordQuestion<T extends Answers = Answers> extends PasswordQuestionOptions<T> {
/**
* Provides options for a question for the `NumberPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface NumberQuestionOptions<T extends Answers = Answers> extends InputQuestionOptions<T> {}
type: 'password';
}
/**
* Represents a list-based question that can loop.
*
* @template T
* The type of the answers.
*
* @template TChoiceMap
* The valid choices for the question.
*/
interface LoopableListQuestionOptionsBase<T extends Answers, TChoiceMap> extends ListQuestionOptionsBase<T, TChoiceMap> {
/**
* Provides options for a question for the `NumberPrompt`.
*
* @template T
* The type of the answers.
* A value indicating whether choices in a list should be looped.
*/
interface NumberQuestion<T extends Answers = Answers> extends NumberQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'number';
}
loop?: boolean | undefined;
}
/**
* Provides options for a question for the {@link ListPrompt `ListPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ListQuestionOptions<T extends Answers = Answers>
extends LoopableListQuestionOptionsBase<T, ListChoiceMap<T>> { }
/**
* Provides options for a question for the {@link ListPrompt `ListPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ListQuestion<T extends Answers = Answers> extends ListQuestionOptions<T> {
/**
* Provides options for a question for the `PasswordPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface PasswordQuestionOptions<T extends Answers = Answers> extends InputQuestionOptions<T> {
/**
* The character to replace the user-input.
*/
mask?: string | undefined;
}
type: 'list';
}
/**
* Provides options for a question for the {@link RawListPrompt `RawListPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface RawListQuestionOptions<T extends Answers = Answers> extends ListQuestionOptions<T> { }
/**
* Provides options for a question for the {@link RawListPrompt `RawListPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface RawListQuestion<T extends Answers = Answers> extends RawListQuestionOptions<T> {
/**
* Provides options for a question for the `PasswordPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface PasswordQuestion<T extends Answers = Answers> extends PasswordQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'password';
}
type: 'rawlist';
}
/**
* Provides options for a question for the {@link ExpandPrompt `ExpandPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ExpandQuestionOptions<T extends Answers = Answers>
extends ListQuestionOptionsBase<T, ExpandChoiceMap<T>> { }
/**
* Provides options for a question for the {@link ExpandPrompt `ExpandPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ExpandQuestion<T extends Answers = Answers> extends ExpandQuestionOptions<T> {
/**
* Represents a list-based question that can loop.
*
* @template T
* The type of the answers.
*
* @template TChoiceMap
* The valid choices for the question.
* @inheritdoc
*/
interface LoopableListQuestionOptionsBase<T extends Answers, TChoiceMap extends Answers> extends ListQuestionOptionsBase<T, TChoiceMap> {
/**
* A value indicating whether choices in a list should be looped.
*/
loop?: boolean | undefined;
}
type: 'expand';
}
/**
* Provides options for a question for the {@link CheckboxPrompt `CheckboxPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface CheckboxQuestionOptions<T extends Answers = Answers>
extends LoopableListQuestionOptionsBase<T, CheckboxChoiceMap<T>> { }
/**
* Provides options for a question for the {@link CheckboxPrompt `CheckboxPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface CheckboxQuestion<T extends Answers = Answers> extends CheckboxQuestionOptions<T> {
/**
* Provides options for a question for the `ListPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface ListQuestionOptions<T extends Answers = Answers>
extends LoopableListQuestionOptionsBase<T, ListChoiceMap<T>> {}
type: 'checkbox';
}
/**
* Provides options for a question for the {@link ConfirmPrompt `ConfirmPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ConfirmQuestionOptions<T extends Answers = Answers> extends Question<T> { }
/**
* Provides options for a question for the {@link ConfirmPrompt `ConfirmPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface ConfirmQuestion<T extends Answers = Answers> extends ConfirmQuestionOptions<T> {
/**
* Provides options for a question for the `ListPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface ListQuestion<T extends Answers = Answers> extends ListQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'list';
}
type: 'confirm';
}
/**
* Provides options for a question for the {@link EditorPrompt `EditorPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface EditorQuestionOptions<T extends Answers = Answers> extends Question<T> {
/**
* Provides options for a question for the `RawListPrompt`.
* The postfix of the file being edited.
*
* @template T
* The type of the answers.
* Adding this will add color highlighting to the file content in most editors.
*/
interface RawListQuestionOptions<T extends Answers = Answers> extends ListQuestionOptions<T> {}
postfix?: string;
}
/**
* Provides options for a question for the {@link EditorPrompt `EditorPrompt<TQuestion>`}.
*
* @template T
* The type of the answers.
*/
export interface EditorQuestion<T extends Answers = Answers> extends EditorQuestionOptions<T> {
/**
* Provides options for a question for the `RawListPrompt`.
*
* @template T
* The type of the answers.
* @inheritdoc
*/
interface RawListQuestion<T extends Answers = Answers> extends RawListQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'rawlist';
}
type: 'editor';
}
/**
* Provides the available question-types.
*
* @template T
* The type of the answers.
*/
export interface QuestionMap<T extends Answers = Answers> {
/**
* Provides options for a question for the `ExpandPrompt`.
*
* @template T
* The type of the answers.
* The {@link InputQuestion `InputQuestion<T>`} type.
*/
interface ExpandQuestionOptions<T extends Answers = Answers>
extends ListQuestionOptionsBase<T, ExpandChoiceMap<T>> {}
input: InputQuestion<T>;
/**
* Provides options for a question for the `ExpandPrompt`.
*
* @template T
* The type of the answers.
* The {@link NumberQuestion `NumberQuestion<T>`} type.
*/
interface ExpandQuestion<T extends Answers = Answers> extends ExpandQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'expand';
}
number: NumberQuestion<T>;
/**
* Provides options for a question for the `CheckboxPrompt`.
*
* @template T
* The type of the answers.
* The {@link PasswordQuestion `PasswordQuestion<T>`} type.
*/
interface CheckboxQuestionOptions<T extends Answers = Answers>
extends LoopableListQuestionOptionsBase<T, CheckboxChoiceMap<T>> {}
password: PasswordQuestion<T>;
/**
* Provides options for a question for the `CheckboxPrompt`.
*
* @template T
* The type of the answers.
* The {@link ListQuestion `ListQuestion<T>`} type.
*/
interface CheckboxQuestion<T extends Answers = Answers> extends CheckboxQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'checkbox';
}
list: ListQuestion<T>;
/**
* Provides options for a question for the `ConfirmPrompt`.
*
* @template T
* The type of the answers.
* The {@link RawListQuestion `RawListQuestion<T>`} type.
*/
interface ConfirmQuestionOptions<T extends Answers = Answers> extends Question<T> {}
rawList: RawListQuestion<T>;
/**
* Provides options for a question for the `ConfirmPrompt`.
*
* @template T
* The type of the answers.
* The {@link ExpandQuestion `ExpandQuestion<T>`} type.
*/
interface ConfirmQuestion<T extends Answers = Answers> extends ConfirmQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'confirm';
}
expand: ExpandQuestion<T>;
/**
* Provides options for a question for the `EditorPrompt`.
*
* @template T
* The type of the answers.
* The {@link CheckboxQuestion `CheckboxQuestion<T>`} type.
*/
interface EditorQuestionOptions<T extends Answers = Answers> extends Question<T> {}
checkbox: CheckboxQuestion<T>;
/**
* Provides options for a question for the `EditorPrompt`.
*
* @template T
* The type of the answers.
* The {@link ConfirmQuestion `ConfirmQuestion<T>`} type.
*/
interface EditorQuestion<T extends Answers = Answers> extends EditorQuestionOptions<T> {
/**
* @inheritdoc
*/
type: 'editor';
}
confirm: ConfirmQuestion<T>;
/**
* Provides the available question-types.
*
* @template T
* The type of the answers.
* The {@link EditorQuestion `EditorQuestion<T>`} type.
*/
interface QuestionMap<T extends Answers = Answers> {
/**
* The `InputQuestion` type.
*/
input: InputQuestion<T>;
editor: EditorQuestion<T>;
}
/**
* The `NumberQuestion` type.
*/
number: NumberQuestion<T>;
/**
* Represents one of the available questions.
*
* @template T
* The type of the answers.
*/
export type DistinctQuestion<T extends Answers = Answers> = QuestionMap<T>[keyof QuestionMap<T>];
/**
* The `PasswordQuestion` type.
*/
password: PasswordQuestion<T>;
/**
* Indicates the type of a question
*/
export type QuestionTypeName = DistinctQuestion['type'];
/**
* The `ListQuestion` type.
*/
list: ListQuestion<T>;
/**
* Represents a collection of questions.
*
* @template T
* The type of the answers.
*/
export type QuestionCollection<T extends Answers = Answers> =
| DistinctQuestion<T>
| ReadonlyArray<DistinctQuestion<T>>
| Observable<DistinctQuestion<T>>
| { [P in KeyUnion<T>]?: DistinctQuestion<T> & { name?: never } };
/**
* The `RawListQuestion` type.
*/
rawList: RawListQuestion<T>;
/**
* Provides an input and an output-stream.
*/
export interface StreamOptions {
/**
* A stream to read the input from.
*/
input?: NodeJS.ReadStream | undefined;
/**
* The `ExpandQuestion` type.
*/
expand: ExpandQuestion<T>;
/**
* A stream to write the output to.
*/
output?: NodeJS.WriteStream | undefined;
}
/**
* The `CheckboxQuestion` type.
*/
checkbox: CheckboxQuestion<T>;
/**
* The `ConfirmQuestion` type.
*/
confirm: ConfirmQuestion<T>;
/**
* The `EditorQuestion` type.
*/
editor: EditorQuestion<T>;
}
/**
* Provides the functionality to prompt questions to the user.
*/
export interface PromptModule extends PromptModuleBase {
/**
* Represents one of the available questions.
*
* @template T
* The type of the answers.
* The prompts of the prompt-module.
*/
type DistinctQuestion<T extends Answers = Answers> = QuestionMap<T>[keyof QuestionMap<T>];
prompts: inquirer.prompts.PromptCollection;
/**
* Indicates the type of a question
* Prompts the questions to the user.
*/
type QuestionTypeName = DistinctQuestion['type'];
<T extends Answers = Answers>(questions: QuestionCollection<T>, initialAnswers?: Partial<T>): Promise<T> & { ui: inquirer.ui.Prompt<T> };
/**
* Represents a collection of questions.
* Registers a new prompt-type.
*
* @template T
* The type of the answers.
* @param name
* The name of the prompt.
*
* @param prompt
* The constructor of the prompt.
*/
type QuestionCollection<T extends Answers = Answers> =
| DistinctQuestion<T>
| ReadonlyArray<DistinctQuestion<T>>
| Observable<DistinctQuestion<T>>;
registerPrompt(name: string, prompt: inquirer.prompts.PromptConstructor): this;
}
/**
* Provides the functionality to prompt questions.
*/
declare namespace inquirer {
/**

@@ -823,3 +802,3 @@ * Provides components for the prompts.

/**
* Provides a base for and prompt-options.
* Provides options for a prompt.
*

@@ -875,3 +854,3 @@ * @template T

*/
new (question: any, readLine: ReadlineInterface, answers: Answers): PromptBase;
new(question: any, readLine: ReadlineInterface, answers: Answers): PromptBase;
}

@@ -889,3 +868,3 @@

/**
* Either a string which describes the error of the prompt or a boolean indicating whether the prompt-value is valid.
* Either a {@link String `string`} which describes the error of the prompt or a {@link Boolean `boolean`} indicating whether the prompt-value is valid.
*/

@@ -931,3 +910,3 @@ isValid: string | boolean;

/**
* A pypeline for succesful inputs.
* A pipeline for successful inputs.
*/

@@ -948,2 +927,161 @@ success: Observable<SuccessfulPromptStateData<T>>;

/**
* Represents the bottom-bar UI.
*/
class BottomBar extends UI {
/**
* Gets or sets a stream to write logs to.
*/
log: ThroughStream;
/**
* Initializes a new instance of the {@link BottomBar `BottomBar`} class.
*
* @param options
* Provides options for the bottom-bar ui.
*/
constructor(options?: BottomBarOptions);
/**
* Renders the specified {@link text `text`} to the bottom bar.
*
* @param text
* The text to print to the bottom bar.
*/
updateBottomBar(text: string): this;
/**
* Renders the bottom bar.
*/
protected render(): this;
/**
* Cleans the bottom bar.
*/
protected clean(): this;
/**
* Writes a message to the bottom bar.
*
* @param message
* The message to write.
*/
protected write(message: string): void;
/**
* Writes the specified {@link data `data`} to the log-zone.
*
* @param data
* The data to write to the log-zone.
*/
protected writeLog(data: any): this;
/**
* Fixes the new-line characters of the specified {@link text `text`}.
*
* @param text
* The text to process.
*/
protected enforceLF(text: string): string;
}
/**
* Represents the prompt ui.
*/
class Prompt<T extends Answers = Answers> extends UI {
/**
* Gets or sets the prompts of the ui.
*/
prompts: prompts.PromptCollection;
/**
* Gets or sets the answers provided by the user.
*/
answers: T;
/**
* Gets or sets the event-flow of the process.
*/
process: Observable<QuestionAnswer<T>>;
/**
* Initializes a new instance of the {@link Prompt `Prompt`} class.
*
* @param prompts
* The prompts for the ui.
*
* @param options
* The input- and output-stream of the ui.
*/
constructor(prompts: prompts.PromptCollection, options?: StreamOptions);
/**
* Runs the prompt-UI.
*
* @param questions
* The questions to prompt the user to answer.
*
* @returns
* The answers provided by the user.
*/
run(questions: Array<DistinctQuestion<T>>): Promise<T>;
/**
* Finishes the process.
*/
protected onCompletion(): T;
/**
* Processes a question.
*
* @param question
* The question to process.
*
* @returns
* The answer to the question.
*/
protected processQuestion(
question: DistinctQuestion<T>,
): Observable<FetchedAnswer>;
/**
* Fetches the answer to a question.
*
* @param question
* The question to fetch the answer for.
*
* @returns
* The answer to the question.
*/
protected fetchAnswer(
question: FetchedQuestion<T>,
): Observable<FetchedAnswer>;
/**
* Sets the type of the question if no question-type is specified.
*
* @param question
* The question to set the default type for.
*
* @returns
* The processed question.
*/
protected setDefaultType(
question: DistinctQuestion<T>,
): Observable<DistinctQuestion<T>>;
/**
* Filters the question if it is runnable.
*
* @param question
* The question to filter.
*
* @returns
* Either the event-flow of the question if it is runnable or an empty event-flow.
*/
protected filterIfRunnable(
question: DistinctQuestion<T>,
): Observable<DistinctQuestion<T>>;
}
/**
* Provides options for the bottom-bar UI.

@@ -1001,8 +1139,70 @@ */

}
/**
* Represents a choice-item separator.
*/
class Separator implements SeparatorOptions {
/**
* @inheritdoc
*/
readonly type: 'separator';
/**
* @inheritdoc
*/
line: string;
/**
* Initializes a new instance of the {@link Separator `Separator`} class.
*
* @param line
* The text of the separator.
*/
constructor(line?: string);
/**
* Checks whether the specified {@link item `item`} is not a separator.
*
* @param item
* The item to check.
*
* @returns
* A value indicating whether the item is not a separator.
*/
static exclude(item: any): boolean;
}
/**
* Registers a new prompt-type.
*
* @param name
* The name of the prompt.
*
* @param prompt
* The constructor of the prompt.
*/
let registerPrompt: RegisterFunction;
/**
* Registers the default prompts.
*/
let restoreDefaultPrompts: RestoreFunction;
/**
* Creates a prompt-module.
*
* @param opt
* The streams for the prompt-module.
*
* @returns
* The new prompt-module.
*/
let createPromptModule: PromptModuleCreator;
/**
* The default prompt-module.
*/
let prompt: PromptModule;
}
/**
* Provides the functionality to prompt questions.
*/
declare var inquirer: inquirer.Inquirer;
export = inquirer;
export default inquirer;

@@ -54,3 +54,3 @@ import { Answers, CheckboxChoiceOptions, ExpandChoiceOptions, ListChoiceOptions } from '../..';

/**
* Initializes a new instance of the `Choice` class.
* Initializes a new instance of the {@link Choice `Choice<T>`} class.
*

@@ -66,2 +66,2 @@ * @param value

export = Choice;
export default Choice;
import { AllChoiceMap, Answers, KeyUnion, UnionToIntersection } from '../..';
import Choice = require('./choice');
import Separator = require('./separator');
import Choice from './choice';
import Separator from './separator';
/**
* Represents a valid choice for the `Choices` class.
* Represents a valid choice for the {@link Choices `Choices<T>`} class.
*

@@ -14,3 +14,3 @@ * @template T

/**
* Represents a valid real choice for the `Choices` class.
* Represents a valid real choice for the {@link Choices `Choices<T>`} class.
*

@@ -58,3 +58,3 @@ * @template T

/**
* Initializes a new instance of the `Choices` class.
* Initializes a new instance of the {@link Choices `Choices<T>`} class.
*

@@ -65,3 +65,3 @@ * @param choices

* @param answers
* The `answers`-object.
* The {@link Answers `Answers`}-object.
*/

@@ -104,3 +104,3 @@ constructor(choices: Array<DistinctChoice<T>>, answers: T);

/**
* Retrieves the specified `property` from all choices.
* Retrieves the specified {@link property `property`} from all choices.
*

@@ -129,6 +129,6 @@ * @template TProperty

*
* If fromIndex is omitted, the search starts at index 0.
* If {@link fromIndex `fromIndex`} is omitted, the search starts at index 0.
*
* @returns
* The index of the specified `searchElement`.
* The index of the specified {@link searchElement `searchElement`}.
*/

@@ -143,8 +143,8 @@ indexOf(searchElement: Choice<T> | Separator, fromIndex?: number): number;

*
* `forEach` calls the callbackfn function one time for each element in the array.
* {@link forEach `forEach`} calls the {@link callbackfn `callbackfn`} function one time for each element in the array.
*
* @param thisArg
* An object to which the this keyword can refer in the callbackfn function.
* An object to which the `this` keyword can refer in the {@link callbackfn `callbackfn`} function.
*
* If `thisArg` is omitted, undefined is used as the this value.
* If {@link thisArg `thisArg`} is omitted, `undefined` is used as the `this` value.
*/

@@ -162,8 +162,8 @@ forEach(

*
* The filter method calls the `callbackfn` function one time for each element in the array.
* The filter method calls the {@link callbackfn `callbackfn`} function one time for each element in the array.
*
* @param thisArg
* An object to which the `this` keyword can refer in the callbackfn function.
* An object to which the `this` keyword can refer in the {@link callbackfn `callbackfn`} function.
*
* If `thisArg` is omitted, undefined is used as the this value.
* If {@link thisArg `thisArg`} is omitted, undefined is used as the this value.
*

@@ -183,14 +183,14 @@ * @returns

/**
* Returns the value of the first element in the array where predicate is true, and `undefined` otherwise.
* Returns the value of the first element in the array where predicate is `true`, and `undefined` otherwise.
*
* @param predicate
* `find` calls `predicate` once for each element of the array, in ascending order, until it finds one where predicate returns `true`.
* {@link find `find`} calls {@link predicate `predicate`} once for each element of the array, in ascending order, until it finds one where predicate returns `true`.
*
* If such an element is found, `find` immediately returns that element value.
* Otherwise, find returns undefined.
* If such an element is found, {@link find `find`} immediately returns that element value.
* Otherwise, find returns `undefined`.
*
* @param thisArg
* If provided, it will be used as the `this` value for each invocation of `predicate`.
* If provided, it will be used as the `this` value for each invocation of {@link predicate `predicate`}.
*
* If it is not provided, undefined is used instead.
* If it is not provided, `undefined` is used instead.
*/

@@ -203,3 +203,3 @@ find(

/**
* Appends new elements to an array, and returns the new length of the array.
* Appends new elements to the array, and returns the new length of the array.
*

@@ -215,2 +215,2 @@ * @param items

export = Choices;
export default Choices;

@@ -1,37 +0,3 @@

import { SeparatorOptions } from '../..';
import inquirer from "../..";
/**
* Represents a choice-item separator.
*/
declare class Separator implements SeparatorOptions {
/**
* @inheritdoc
*/
readonly type: 'separator';
/**
* @inheritdoc
*/
line: string;
/**
* Initializes a new instance of the `Separator` class.
*
* @param line
* The text of the separator.
*/
constructor(line?: string);
/**
* Checks whether the specified `item` is not a separator.
*
* @param item
* The item to check.
*
* @returns
* A value indicating whether the item is not a separator.
*/
static exclude(item: any): boolean;
}
export = Separator;
export default inquirer.Separator;
import { Interface as ReadLineInterface } from 'readline';
import { Observable } from 'rxjs';
import inquirer = require('../..');
import ScreenManager = require('../utils/screen-manager');
import inquirer, { Answers, Question } from '../..';
import ScreenManager from '../utils/screen-manager';
/**
* The question-options for the `Prompt<T>`.
*/
type Question = inquirer.Question<inquirer.Answers>;
/**
* Represents a prompt.

@@ -26,3 +21,3 @@ *

*/
protected answers: inquirer.Answers;
protected answers: Answers;

@@ -45,3 +40,3 @@ /**

/**
* Initializes a new instance of the `Prompt<T>` class.
* Initializes a new instance of the {@link Prompt `Prompt<TQuestion>`} class.
*

@@ -55,5 +50,5 @@ * @param question

* @param answers
* The answer-object.
* The {@link Answers `Answers`}-object.
*/
constructor(question: TQuestion, readLine: ReadLineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadLineInterface, answers: Answers);

@@ -74,6 +69,6 @@ /**

/**
* Throws an error for a missing param.
* Throws an error for a missing parameter.
*
* @param name
* The name of the missing param.
* The name of the missing parameter.
*/

@@ -104,2 +99,2 @@ protected throwParamError(name: string): void;

export = Prompt;
export default Prompt;

@@ -1,10 +0,10 @@

import inquirer = require('../..');
import Prompt = require('./base');
import { Interface as ReadLineInterface } from 'readline';
import Paginator = require('../utils/paginator');
import inquirer, { Answers, CheckboxQuestionOptions } from '../..';
import Paginator from '../utils/paginator';
import Prompt from './base';
/**
* The question-options for the `ChoicePrompt<T>`.
* The question-options for the {@link CheckboxPrompt `CheckboxPrompt<TQuestion>`}.
*/
type Question = inquirer.CheckboxQuestionOptions<inquirer.Answers>;
type Question = CheckboxQuestionOptions;

@@ -29,3 +29,3 @@ /**

/**
* Initializes a new instance of the `CheckboxPrompt<T>` class.
* Initializes a new instance of the {@link CheckboxPrompt `CheckboxPrompt<TQuestion>`} class.
*

@@ -41,3 +41,3 @@ * @param question

*/
constructor(question: TQuestion, readLine: ReadLineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadLineInterface, answers: Answers);

@@ -118,2 +118,2 @@ /**

export = CheckboxPrompt;
export default CheckboxPrompt;

@@ -1,7 +0,7 @@

import Prompt = require('./base');
import { Interface as ReadlineInterface } from 'readline';
import { Answers, ConfirmQuestionOptions } from '../..';
import { Interface as ReadlineInterface } from 'readline';
import Prompt from './base';
/**
* The question-options for the `ConfirmPrompt<T>`.
* The question-options for the {@link ConfirmPrompt `ConfirmPrompt<TQuestion>`}.
*/

@@ -18,3 +18,3 @@ type Question = ConfirmQuestionOptions;

/**
* Initializes a new instance of the `ConfirmPrompt<T>` class.
* Initializes a new instance of the {@link ConfirmPrompt `ConfirmPrompt<TQuestion>`} class.
*

@@ -30,3 +30,3 @@ * @param question

*/
constructor(questions: TQuestion, readLine: ReadlineInterface, answers: Answers);
constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);

@@ -55,2 +55,2 @@ /**

export = ConfirmPrompt;
export default ConfirmPrompt;

@@ -1,10 +0,10 @@

import Prompt = require('./base');
import { Interface as ReadlineInterface } from 'readline';
import { Subject, Subscription } from 'rxjs';
import inquirer = require('../..');
import { Interface as ReadlineInterface } from 'readline';
import inquirer, { Answers, EditorQuestionOptions } from '../..';
import Prompt from './base';
/**
* The question-options for the `EditorPrompt<T>`.
* The question-options for the {@link EditorPrompt `EditorPrompt<TQuestion>`}.
*/
type Question = inquirer.EditorQuestionOptions<inquirer.Answers>;
type Question = EditorQuestionOptions;

@@ -39,3 +39,3 @@ /**

/**
* Initializes a new instance of the `EditorPrompt<T>` class.
* Initializes a new instance of the {@link EditorPrompt `EditorPrompt<TQuestion>`} class.
*

@@ -51,3 +51,3 @@ * @param question

*/
constructor(question: TQuestion, readLine: ReadlineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);

@@ -103,2 +103,2 @@ /**

export = EditorPrompt;
export default EditorPrompt;

@@ -1,10 +0,10 @@

import Paginator = require('../utils/paginator');
import Prompt = require('./base');
import inquirer = require('../..');
import { Interface as ReadlineInterface } from 'readline';
import inquirer, { Answers, ExpandQuestionOptions } from '../..';
import Paginator from '../utils/paginator';
import Prompt from './base';
/**
* The question-options for the `ExpandPrompt<T>`.
* The question-options for the {@link ExpandPrompt `ExpandPrompt<TQuestion>`}.
*/
type Question = inquirer.ExpandQuestionOptions<inquirer.Answers>;
type Question = ExpandQuestionOptions;

@@ -49,3 +49,3 @@ /**

/**
* Initializes a new instance of the `ExpandPrompt<T>` class.
* Initializes a new instance of the {@link ExpandPrompt `ExpandPrompt<TQuestion>`} class.
*

@@ -61,3 +61,3 @@ * @param question

*/
constructor(question: TQuestion, readLine: ReadlineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);

@@ -151,2 +151,2 @@ /**

export = ExpandPrompt;
export default ExpandPrompt;

@@ -1,9 +0,9 @@

import Prompt = require('./base');
import inquirer = require('../..');
import { Interface as ReadlineInterface } from 'readline';
import inquirer, { Answers, InputQuestionOptions } from '../..';
import Prompt from './base';
/**
* The question-options for the `InputPrompt<T>`.
* The question-options for the {@link InputPrompt `InputPrompt<TQuestion>`}.
*/
type Question = inquirer.InputQuestionOptions<inquirer.Answers>;
type Question = InputQuestionOptions;

@@ -28,3 +28,3 @@ /**

/**
* Initializes a new instance of the `InputPrompt<T>` class.
* Initializes a new instance of the {@link InputPrompt `InputPrompt<TQuestion>`} class.
*

@@ -40,3 +40,3 @@ * @param question

*/
constructor(question: TQuestion, readLine: ReadlineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);

@@ -52,3 +52,3 @@ /**

/**
* Filters the specified `input`.
* Filters the specified {@link input `input`}.
*

@@ -67,3 +67,3 @@ * @param input

* @param eventArgs
* An object which contains eventr-data.
* An object which contains event-data.
*/

@@ -86,2 +86,2 @@ protected onEnd(eventArgs: inquirer.prompts.SuccessfulPromptStateData): void;

export = InputPrompt;
export default InputPrompt;

@@ -1,8 +0,8 @@

import Prompt = require('./base');
import { Interface as ReadlineInterface } from 'readline';
import { Answers, ListQuestionOptions } from '../..';
import Paginator = require('../utils/paginator');
import { Interface as ReadlineInterface } from 'readline';
import Paginator from '../utils/paginator';
import Prompt from './base';
/**
* The question-options for the `ListPrompt<T>`.
* The question-options for the {@link ListPrompt `ListPrompt<TQuestion>`}.
*/

@@ -39,3 +39,3 @@ type Question = ListQuestionOptions;

/**
* Initializes a new instance of the `ListPrompt<T>` class.
* Initializes a new instance of the {@link ListPrompt `ListPrompt<TQuestion>`} class.
*

@@ -90,2 +90,2 @@ * @param question

export = ListPrompt;
export default ListPrompt;

@@ -1,7 +0,7 @@

import InputPrompt = require('./input');
import { Interface as ReadlineInterface } from 'readline';
import { Answers, NumberQuestionOptions } from '../..';
import { Interface as ReadlineInterface } from 'readline';
import InputPrompt from './input';
/**
* The question for the `NumberPrompt<T>`.
* The question for the {@link NumberPrompt `NumberPrompt<TQuestion>`}.
*/

@@ -18,3 +18,3 @@ type Question = NumberQuestionOptions;

/**
* Initializes a new instance of the `NumberPrompt<T>` class.
* Initializes a new instance of the {@link NumberPrompt `NumberPrompt<TQuestion>`} class.
*

@@ -33,2 +33,2 @@ * @param question

export = NumberPrompt;
export default NumberPrompt;

@@ -1,9 +0,9 @@

import Prompt = require('./base');
import inquirer = require('../..');
import { Interface as ReadlineInterface } from 'readline';
import inquirer, { Answers, PasswordQuestionOptions } from '../..';
import Prompt from './base';
/**
* The question for the `PasswordPrompt<T>`.
* The question for the {@link PasswordPrompt `PasswordPrompt<TQuestion>`}.
*/
type Question = inquirer.PasswordQuestionOptions<inquirer.Answers>;
type Question = PasswordQuestionOptions;

@@ -28,3 +28,3 @@ /**

/**
* Initializes a new instance of the `PasswordPrompt<T>` class.
* Initializes a new instance of the {@link PasswordPrompt `PasswordPrompt<TQuestion>`} class.
*

@@ -40,3 +40,3 @@ * @param question

*/
constructor(question: TQuestion, readLine: ReadlineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);

@@ -52,3 +52,3 @@ /**

/**
* Filters the specified `input`.
* Filters the specified {@link input `input`}.
*

@@ -85,2 +85,2 @@ * @param input

export = PasswordPrompt;
export default PasswordPrompt;

@@ -1,10 +0,10 @@

import inquirer = require('../..');
import Prompt = require('./base');
import Paginator = require('../utils/paginator');
import { Interface as ReadlineInterface } from 'readline';
import inquirer, { Answers, RawListQuestionOptions } from '../..';
import Paginator from '../utils/paginator';
import Prompt from './base';
/**
* The question for the `RawListPrompt<T>`.
* The question for the {@link RawListPrompt `RawListPrompt<TQuestion>`}.
*/
type Question = inquirer.RawListQuestionOptions<inquirer.Answers>;
type Question = RawListQuestionOptions;

@@ -39,3 +39,3 @@ /**

/**
* Initializes a new instance of the `RawListPrompt<T>` class.
* Initializes a new instance of the {@link RawListPrompt `RawListPrompt<TQuestion>`} class.
*

@@ -51,3 +51,3 @@ * @param question

*/
constructor(question: TQuestion, readLine: ReadlineInterface, answers: inquirer.Answers);
constructor(question: TQuestion, readLine: ReadlineInterface, answers: Answers);

@@ -63,3 +63,3 @@ /**

/**
* Gets the value of the specified `index`.
* Gets the value of the specified {@link index `index`}.
*

@@ -70,3 +70,3 @@ * @param index

* @returns
* The value of the specified `index`.
* The value of the specified {@link index `index`}.
*/

@@ -115,2 +115,2 @@ protected getCurrentValue(index: number): any;

export = RawListPrompt;
export default RawListPrompt;
import { Interface as ReadlineInterface } from 'readline';
import inquirer = require('../..');
import inquirer, { StreamOptions } from '../..';

@@ -19,3 +19,3 @@ /**

/**
* Initializes a new instance of the `UI` class.
* Initializes a new instance of the {@link UI `UI`} class.
*

@@ -25,3 +25,3 @@ * @param options

*/
constructor(options?: inquirer.StreamOptions);
constructor(options?: StreamOptions);

@@ -39,2 +39,2 @@ /**

export = UI;
export default UI;

@@ -1,65 +0,3 @@

import { ThroughStream } from 'through';
import inquirer = require('../..');
import UI = require('./baseUI');
import inquirer from '../..';
/**
* Represents the bottom-bar UI.
*/
declare class BottomBar extends UI {
/**
* Gets or sets a stream to write logs to.
*/
log: ThroughStream;
/**
* Initializes a new instance of the `BottomBar` class.
*
* @param options
* Provides options for the bottom-bar ui.
*/
constructor(options?: inquirer.ui.BottomBarOptions);
/**
* Renders the specified `text` to the bottom bar.
*
* @param text
* The text to print to the bottom bar.
*/
updateBottomBar(text: string): this;
/**
* Renders the bottom bar.
*/
protected render(): this;
/**
* Clean the bottom bar.
*/
protected clean(): this;
/**
* Writes a message to the bottom bar.
*
* @param message
* The message to write.
*/
protected write(message: string): void;
/**
* Writes the specified `data` to the log-zone.
*
* @param data
* The data to write to the log-zone.
*/
protected writeLog(data: any): this;
/**
* Fixes the new-line characters of the specified `text`.
*
* @param text
* The text to process.
*/
protected enforceLF(text: string): string;
}
export = BottomBar;
export default inquirer.ui.BottomBar;

@@ -1,104 +0,3 @@

import { Observable } from 'rxjs';
import inquirer = require('../..');
import UI = require('./baseUI');
import inquirer from '../..';
/**
* Represents the prompt ui.
*/
declare class PromptUI<T extends inquirer.Answers = inquirer.Answers> extends UI {
/**
* Gets or sets the prompts of the ui.
*/
prompts: inquirer.prompts.PromptCollection;
/**
* Gets or sets the answers provided by the user.
*/
answers: T;
/**
* Gets or sets the event-flow of the process.
*/
process: Observable<inquirer.QuestionAnswer<T>>;
/**
* Initializes a new instance of the `PromptUI` class.
*
* @param prompts
* The prompts for the ui.
*
* @param options
* The input- and output-stream of the ui.
*/
constructor(prompts: inquirer.prompts.PromptCollection, options?: inquirer.StreamOptions);
/**
* Runs the prompt-UI.
*
* @param questions
* The questions to prompt the user to answer.
*
* @returns
* The answers provided by the user.
*/
run(questions: Array<inquirer.DistinctQuestion<T>>): Promise<T>;
/**
* Finishes the process.
*/
protected onCompletion(): T;
/**
* Processes a question.
*
* @param question
* The question to process.
*
* @returns
* The answer to the question.
*/
protected processQuestion(
question: inquirer.DistinctQuestion<T>,
): Observable<inquirer.ui.FetchedAnswer>;
/**
* Fetches the answer to a question.
*
* @param question
* The question to fetch the answer for.
*
* @returns
* The answer to the question.
*/
protected fetchAnswer(
question: inquirer.ui.FetchedQuestion<T>,
): Observable<inquirer.ui.FetchedAnswer>;
/**
* Sets the type of the question if no question-type is specified.
*
* @param question
* The question to set the default type for.
*
* @returns
* The processed question.
*/
protected setDefaultType(
question: inquirer.DistinctQuestion<T>,
): Observable<inquirer.DistinctQuestion<T>>;
/**
* Filters the question if it is runnable.
*
* @param question
* The question to filter.
*
* @returns
* Either the event-flow of the question if it is runnable or an empty event-flow.
*/
protected filterIfRunnable(
question: inquirer.DistinctQuestion<T>,
): Observable<inquirer.DistinctQuestion<T>>;
}
export = PromptUI;
export default inquirer.ui.Prompt;

@@ -14,3 +14,3 @@ import { Interface as ReadlineInterface, Key } from 'readline';

/**
* Thedescription of the key.
* The description of the key.
*/

@@ -25,3 +25,3 @@ key: Key;

/**
* The event-flow of the `line`-event of the readline-object.
* The event-flow of the `line`-event of the {@link ReadlineInterface `readline.Interface`}-object.
*/

@@ -31,3 +31,3 @@ line: Observable<string>;

/**
* The event-flow of the `keypress`-event of the readline-object.
* The event-flow of the `keypress`-event of the {@link ReadlineInterface `readline.Interface`}-object.
*/

@@ -68,3 +68,3 @@ keypress: Observable<KeyDescriptor>;

/**
* Observes a readline-object.
* Observes a {@link ReadlineInterface `readline.Interface`}-object.
*

@@ -74,4 +74,4 @@ * @param readline

*/
declare function observe(readline: ReadlineInterface): Events;
export default function(readline: ReadlineInterface): Events;
export = observe;
export {};

@@ -1,2 +0,2 @@

import Choices = require('../objects/choices');
import Choices from '../objects/choices';

@@ -23,2 +23,2 @@ type Direction = 'up' | 'down';

export = incrementListIndex;
export default incrementListIndex;

@@ -1,2 +0,2 @@

import ScreenManager = require('./screen-manager');
import ScreenManager from './screen-manager';

@@ -11,3 +11,3 @@ interface PaginatorOptions {

/**
* Provides the functionality to draw paginated content using a `ScreenManager`.
* Provides the functionality to draw paginated content using a {@link ScreenManager `ScreenManager`}.
*/

@@ -31,3 +31,3 @@ declare class Paginator {

/**
* Initializes a new instance of the `Paginator` class.
* Initializes a new instance of the {@link Paginator `Paginator`} class.
*

@@ -40,3 +40,3 @@ * @param screenManager

/**
* Paginates the specified `content`.
* Paginates the specified {@link content `content`}.
*

@@ -58,2 +58,2 @@ * @param content

export = Paginator;
export default Paginator;

@@ -18,3 +18,3 @@ import { Interface as ReadLineInterface } from 'readline';

/**
* Gets or sets an object for performing read from and write to the console.
* Gets or sets an object for reading from and writing to the console.
*/

@@ -24,6 +24,6 @@ rl: ReadLineInterface;

/**
* Initializes a new instance of the `ScreenManager` class.
* Initializes a new instance of the {@link ScreenManager `ScreenManager`} class.
*
* @param readLine
* An object for performing read from and write to the console.
* An object for reading from and writing to the console.
*/

@@ -44,3 +44,3 @@ constructor(readLine: ReadLineInterface);

/**
* Cleans all lines expect the first `extraLines`.
* Cleans all lines expect the first {@link extraLines `extraLines`}.
*

@@ -71,3 +71,3 @@ * @param extraLines

/**
* Splits the `text` into multiple lines with the specified max `width`.
* Splits the {@link text `text`} into multiple lines with the specified maximum {@link width `width`}.
*

@@ -83,3 +83,3 @@ * @param text

/**
* Adds line-breaks to the specified `text` with the specified max `width`.
* Adds line-breaks to the specified {@link text `text`} with the specified maximum {@link width `width`}.
*

@@ -90,3 +90,3 @@ * @param text

* @param width
* The max width of each line.
* The maximum width of each line.
*/

@@ -96,2 +96,2 @@ protected forceLineReturn(text: string, width: number): string;

export = ScreenManager;
export default ScreenManager;

@@ -0,3 +1,3 @@

import { Observable } from 'rxjs';
import { Answers, DistinctQuestion, KeyUnion, UnionToIntersection } from '../..';
import { Observable } from 'rxjs';

@@ -10,3 +10,3 @@ /**

/**
* Fetches a property of the specified `question`.
* Fetches a property of the specified {@link question `question`}.
*

@@ -28,5 +28,4 @@ * @param question

prop: QuestionProperty,
answers: Answers,
): Observable<DistinctQuestion>;
answers: Answers): Observable<DistinctQuestion>;
export {};
{
"name": "@types/inquirer",
"version": "8.2.1",
"version": "9.0.0",
"description": "TypeScript definitions for inquirer",

@@ -76,4 +76,5 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/inquirer",

},
"typesPublisherContentHash": "c92548e26fa63530a4fc33c6f3e61d02a8904261949fa4c965fb2b5141919170",
"typeScriptVersion": "4.2"
"typesPublisherContentHash": "1554c3fdae36f07993959409072f67d81cc6de027eab51c469abd4000020670d",
"typeScriptVersion": "4.2",
"type": "module"
}

@@ -11,3 +11,3 @@ # Installation

### Additional Details
* Last updated: Wed, 30 Mar 2022 07:31:44 GMT
* Last updated: Thu, 04 Aug 2022 22:02:19 GMT
* Dependencies: [@types/rxjs](https://npmjs.com/package/@types/rxjs), [@types/through](https://npmjs.com/package/@types/through)

@@ -14,0 +14,0 @@ * Global values: none

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc