Skip to content

Commit

Permalink
fix(types): allow JQueryAjaxSettings objects for modules using apiSet…
Browse files Browse the repository at this point in the history
…tings

Following Fomantic's documentation, apiSettings can also accept a JQueryAjaxSettings object as parameter. So this PR enable correct type checking for modules that includes apiSettings as a parameter: dropdown, search and tab as well as the api module itself
  • Loading branch information
prudho authored Jun 27, 2023
1 parent 40a7aee commit 5aee397
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions types/fomantic-ui-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ declare namespace FomanticUI {
*/
(behavior: 'destroy'): JQuery;

<K extends keyof AccordionSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<AccordionSettings, keyof AccordionSettings>>;
<K extends keyof AccordionSettings>(behavior: 'setting', name: K, value: AccordionSettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
(settings?: Partial<Pick<AccordionSettings, keyof AccordionSettings>>): JQuery;
<K extends keyof APISettings | JQueryAjaxSettings>(behavior: 'setting', name: K, value?: undefined, ): Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>;
<K extends keyof APISettings>(behavior: 'setting', name: K, value: APISettings[K]): JQuery;
(behavior: 'setting', value: Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>): JQuery;
(settings?: Partial<Pick<APISettings, keyof APISettings>> | Partial<Pick<JQueryAjaxSettings, keyof JQueryAjaxSettings>>): JQuery;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ declare namespace FomanticUI {
* @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
* @default false
*/
apiSettings: false | APISettings;
apiSettings: false | APISettings | JQueryAjaxSettings;

/**
* Whether dropdown should select new option when using keyboard shortcuts.
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-search.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ declare namespace FomanticUI {
* @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
* @default {}
*/
apiSettings: APISettings;
apiSettings: APISettings | JQueryAjaxSettings;

/**
* Minimum characters to query for results.
Expand Down
2 changes: 1 addition & 1 deletion types/fomantic-ui-tab.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ declare namespace FomanticUI {
* @see {@link https://fomantic-ui.com/behaviors/api.html#/settings}
* @default false
*/
apiSettings: false | FomanticUI.APISettings;
apiSettings: false | FomanticUI.APISettings | JQueryAjaxSettings;

/**
* Can be set to 'hash' or 'state'.
Expand Down

0 comments on commit 5aee397

Please sign in to comment.