@inquirer/select 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -10,7 +10,7 @@ const chalk_1 = __importDefault(require("chalk"));
10
10
  const figures_1 = __importDefault(require("figures"));
11
11
  const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
12
12
  function isSelectableChoice(choice) {
13
- return choice != null && choice.type !== 'separator' && !choice.disabled;
13
+ return choice != null && !core_1.Separator.isSeparator(choice) && !choice.disabled;
14
14
  }
15
15
  exports.default = (0, core_1.createPrompt)((config, done) => {
16
16
  const { choices } = config;
@@ -63,7 +63,7 @@ exports.default = (0, core_1.createPrompt)((config, done) => {
63
63
  }
64
64
  const allChoices = choices
65
65
  .map((choice, index) => {
66
- if (choice.type === 'separator') {
66
+ if (core_1.Separator.isSeparator(choice)) {
67
67
  return ` ${choice.separator}`;
68
68
  }
69
69
  const line = choice.name || choice.value;
@@ -1,15 +1,14 @@
1
- import { Separator, AsyncPromptConfig, SeparatorType } from '@inquirer/core';
2
- type Choice = {
3
- type?: undefined;
4
- value: string;
1
+ import { Separator, AsyncPromptConfig } from '@inquirer/core';
2
+ type Choice<Value> = {
3
+ value: Value;
5
4
  name?: string;
6
5
  description?: string;
7
6
  disabled?: boolean | string;
7
+ type?: never;
8
8
  };
9
- type SelectConfig = AsyncPromptConfig & {
10
- choices: Array<SeparatorType | Choice>;
11
- pageSize?: number;
12
- };
13
- declare const _default: import("@inquirer/type").Prompt<string, SelectConfig>;
9
+ declare const _default: <Value extends unknown>(config: AsyncPromptConfig & {
10
+ choices: readonly (Separator | Choice<Value>)[];
11
+ pageSize?: number | undefined;
12
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>;
14
13
  export default _default;
15
14
  export { Separator };
@@ -3,7 +3,7 @@ import chalk from 'chalk';
3
3
  import figures from 'figures';
4
4
  import ansiEscapes from 'ansi-escapes';
5
5
  function isSelectableChoice(choice) {
6
- return choice != null && choice.type !== 'separator' && !choice.disabled;
6
+ return choice != null && !Separator.isSeparator(choice) && !choice.disabled;
7
7
  }
8
8
  export default createPrompt((config, done) => {
9
9
  const { choices } = config;
@@ -56,7 +56,7 @@ export default createPrompt((config, done) => {
56
56
  }
57
57
  const allChoices = choices
58
58
  .map((choice, index) => {
59
- if (choice.type === 'separator') {
59
+ if (Separator.isSeparator(choice)) {
60
60
  return ` ${choice.separator}`;
61
61
  }
62
62
  const line = choice.name || choice.value;
@@ -1,15 +1,14 @@
1
- import { Separator, AsyncPromptConfig, SeparatorType } from '@inquirer/core';
2
- type Choice = {
3
- type?: undefined;
4
- value: string;
1
+ import { Separator, AsyncPromptConfig } from '@inquirer/core';
2
+ type Choice<Value> = {
3
+ value: Value;
5
4
  name?: string;
6
5
  description?: string;
7
6
  disabled?: boolean | string;
7
+ type?: never;
8
8
  };
9
- type SelectConfig = AsyncPromptConfig & {
10
- choices: Array<SeparatorType | Choice>;
11
- pageSize?: number;
12
- };
13
- declare const _default: import("@inquirer/type").Prompt<string, SelectConfig>;
9
+ declare const _default: <Value extends unknown>(config: AsyncPromptConfig & {
10
+ choices: readonly (Separator | Choice<Value>)[];
11
+ pageSize?: number | undefined;
12
+ }, context?: import("@inquirer/type").Context | undefined) => Promise<Value>;
14
13
  export default _default;
15
14
  export { Separator };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/select",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Inquirer select/list prompt",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "typings": "./dist/cjs/types/index.d.mts",
@@ -54,7 +54,7 @@
54
54
  "license": "MIT",
55
55
  "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/select/README.md",
56
56
  "dependencies": {
57
- "@inquirer/core": "^1.1.2",
57
+ "@inquirer/core": "^1.2.0",
58
58
  "@inquirer/type": "^1.0.3",
59
59
  "ansi-escapes": "^4.3.2",
60
60
  "chalk": "^4.1.2",
@@ -85,5 +85,5 @@
85
85
  }
86
86
  }
87
87
  },
88
- "gitHead": "fbeb06c92f1e64a88bb77028c7a038768c4291b2"
88
+ "gitHead": "f3a176d916fe26038c9fb57f1ab485aa79c053ce"
89
89
  }