index.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { Separator, type Theme } from '@inquirer/core';
  2. import type { PartialDeep } from '@inquirer/type';
  3. type SearchTheme = {
  4. icon: {
  5. cursor: string;
  6. };
  7. style: {
  8. disabled: (text: string) => string;
  9. searchTerm: (text: string) => string;
  10. description: (text: string) => string;
  11. };
  12. helpMode: 'always' | 'never' | 'auto';
  13. };
  14. type Choice<Value> = {
  15. value: Value;
  16. name?: string;
  17. description?: string;
  18. short?: string;
  19. disabled?: boolean | string;
  20. type?: never;
  21. };
  22. declare const _default: <Value>(config: {
  23. message: string;
  24. source: (term: string | undefined, opt: {
  25. signal: AbortSignal;
  26. }) => readonly (string | Separator)[] | readonly (Separator | Choice<Value>)[] | Promise<readonly (string | Separator)[]> | Promise<readonly (Separator | Choice<Value>)[]>;
  27. validate?: ((value: Value) => boolean | string | Promise<string | boolean>) | undefined;
  28. pageSize?: number | undefined;
  29. theme?: PartialDeep<Theme<SearchTheme>> | undefined;
  30. }, context?: import("@inquirer/type").Context) => Promise<Value> & {
  31. cancel: () => void;
  32. };
  33. export default _default;
  34. export { Separator } from '@inquirer/core';