Skip to content

Commit 0718b07

Browse files
fix: export missing types from @clack/core (#238)
Co-authored-by: James Garbutt <43081j@users.noreply.github.com>
1 parent acc4c3a commit 0718b07

File tree

10 files changed

+24
-8
lines changed

10 files changed

+24
-8
lines changed

.changeset/afraid-worms-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clack/core': patch
3+
---
4+
5+
fix: export `*Options` types for prompts.

packages/core/src/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
export type { AutocompleteOptions } from './prompts/autocomplete.js';
2+
export type { ConfirmOptions } from './prompts/confirm.js';
3+
export type { GroupMultiSelectOptions } from './prompts/group-multiselect.js';
4+
export type { MultiSelectOptions } from './prompts/multi-select.js';
5+
export type { PasswordOptions } from './prompts/password.js';
6+
export type { PromptOptions } from './prompts/prompt.js';
7+
export type { SelectKeyOptions } from './prompts/select-key.js';
8+
export type { SelectOptions } from './prompts/select.js';
9+
export type { TextOptions } from './prompts/text.js';
10+
111
export { default as AutocompletePrompt } from './prompts/autocomplete.js';
212
export { default as ConfirmPrompt } from './prompts/confirm.js';
313
export { default as GroupMultiSelectPrompt } from './prompts/group-multiselect.js';

packages/core/src/prompts/autocomplete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function normalisedValue<T>(multiple: boolean, values: T[] | undefined): T | T[]
4444
return values[0];
4545
}
4646

47-
interface AutocompleteOptions<T extends OptionLike>
47+
export interface AutocompleteOptions<T extends OptionLike>
4848
extends PromptOptions<T['value'] | T['value'][], AutocompletePrompt<T>> {
4949
options: T[] | ((this: AutocompletePrompt<T>) => T[]);
5050
filter?: FilterFunction<T>;

packages/core/src/prompts/confirm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { cursor } from 'sisteransi';
22
import Prompt, { type PromptOptions } from './prompt.js';
33

4-
interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {
4+
export interface ConfirmOptions extends PromptOptions<boolean, ConfirmPrompt> {
55
active: string;
66
inactive: string;
77
initialValue?: boolean;
88
}
9+
910
export default class ConfirmPrompt extends Prompt<boolean> {
1011
get cursor() {
1112
return this.value ? 0 : 1;

packages/core/src/prompts/group-multiselect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Prompt, { type PromptOptions } from './prompt.js';
22

3-
interface GroupMultiSelectOptions<T extends { value: any }>
3+
export interface GroupMultiSelectOptions<T extends { value: any }>
44
extends PromptOptions<T['value'][], GroupMultiSelectPrompt<T>> {
55
options: Record<string, T[]>;
66
initialValues?: T['value'][];

packages/core/src/prompts/multi-select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface OptionLike {
66
disabled?: boolean;
77
}
88

9-
interface MultiSelectOptions<T extends OptionLike>
9+
export interface MultiSelectOptions<T extends OptionLike>
1010
extends PromptOptions<T['value'][], MultiSelectPrompt<T>> {
1111
options: T[];
1212
initialValues?: T['value'][];

packages/core/src/prompts/password.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import color from 'picocolors';
22
import Prompt, { type PromptOptions } from './prompt.js';
33

4-
interface PasswordOptions extends PromptOptions<string, PasswordPrompt> {
4+
export interface PasswordOptions extends PromptOptions<string, PasswordPrompt> {
55
mask?: string;
66
}
77
export default class PasswordPrompt extends Prompt<string> {

packages/core/src/prompts/select-key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Prompt, { type PromptOptions } from './prompt.js';
22

3-
interface SelectKeyOptions<T extends { value: string }>
3+
export interface SelectKeyOptions<T extends { value: string }>
44
extends PromptOptions<T['value'], SelectKeyPrompt<T>> {
55
options: T[];
66
}

packages/core/src/prompts/select.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { findCursor } from '../utils/cursor.js';
22
import Prompt, { type PromptOptions } from './prompt.js';
33

4-
interface SelectOptions<T extends { value: any; disabled?: boolean }>
4+
export interface SelectOptions<T extends { value: any; disabled?: boolean }>
55
extends PromptOptions<T['value'], SelectPrompt<T>> {
66
options: T[];
77
initialValue?: T['value'];

packages/core/src/prompts/text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import color from 'picocolors';
22
import Prompt, { type PromptOptions } from './prompt.js';
33

4-
interface TextOptions extends PromptOptions<string, TextPrompt> {
4+
export interface TextOptions extends PromptOptions<string, TextPrompt> {
55
placeholder?: string;
66
defaultValue?: string;
77
}

0 commit comments

Comments
 (0)