clack.d.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Type declarations for @clack/prompts
  3. *
  4. * The package ships ESM-only (.d.mts) which TypeScript can't resolve
  5. * with moduleResolution "node". We declare the subset we use here.
  6. */
  7. declare module '@clack/prompts' {
  8. export function intro(title?: string): void;
  9. export function outro(message?: string): void;
  10. export function cancel(message?: string): void;
  11. export function isCancel(value: unknown): value is symbol;
  12. export function confirm(opts: {
  13. message: string;
  14. active?: string;
  15. inactive?: string;
  16. initialValue?: boolean;
  17. }): Promise<boolean | symbol>;
  18. export function select<Value>(opts: {
  19. message: string;
  20. options: { value: Value; label: string; hint?: string }[];
  21. initialValue?: Value;
  22. }): Promise<Value | symbol>;
  23. export function multiselect<Value>(opts: {
  24. message: string;
  25. options: { value: Value; label: string; hint?: string }[];
  26. initialValues?: Value[];
  27. required?: boolean;
  28. }): Promise<Value[] | symbol>;
  29. export function spinner(): {
  30. start(message?: string): void;
  31. stop(message?: string): void;
  32. message(message?: string): void;
  33. };
  34. export function note(message: string, title?: string): void;
  35. export const log: {
  36. message(message: string): void;
  37. info(message: string): void;
  38. success(message: string): void;
  39. step(message: string): void;
  40. warn(message: string): void;
  41. error(message: string): void;
  42. };
  43. }