Skip to content

Commit

Permalink
Type: password config type (#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjx1995 authored Jul 28, 2023
1 parent 790b805 commit 8b02d17
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/password/src/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import type { Prompt } from '@inquirer/type';
import input from '@inquirer/input';
import chalk from 'chalk';

type PasswordConfig = Parameters<typeof input>[0] & {
type InputConfig = Parameters<typeof input>[0];
type PasswordConfig = InputConfig & {
mask?: boolean | string;
};

const password: Prompt<string, PasswordConfig> = (config, context) => {
if (config.transformer) {
const password: Prompt<string, Omit<PasswordConfig, 'transformer' | 'default'>> = (
config,
context,
) => {
if ('transformer' in config) {
throw new Error(
'Inquirer password prompt do not support custom transformer function. Use the input prompt instead.',
);
Expand Down

0 comments on commit 8b02d17

Please sign in to comment.