Skip to content

Commit

Permalink
Improve ResponsePickerApi type
Browse files Browse the repository at this point in the history
  • Loading branch information
snamoah committed Dec 17, 2024
1 parent 9ce3684 commit d243c2b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ interface Filters {
query?: string;
}

export interface ResourcePickerOptions {
export interface ResourcePickerOptions<Type extends keyof ResourceTypes> {
/**
* The type of resource you want to pick.
*/
type: 'product' | 'variant' | 'collection';
type: Type;
/**
* The action verb appears in the title and as the primary action of the Resource Picker.
* @defaultValue 'add'
Expand Down Expand Up @@ -235,6 +235,6 @@ export interface ResourcePickerOptions {
selectionIds?: BaseResource[];
}

export type ResourcePickerApi = (
options: ResourcePickerOptions,
) => Promise<SelectPayload<ResourcePickerOptions['type']> | undefined>;
export type ResourcePickerApi = <Type extends keyof ResourceTypes>(
options: ResourcePickerOptions<Type>,
) => Promise<SelectPayload<Type> | undefined>;

0 comments on commit d243c2b

Please sign in to comment.