Skip to content

Commit 59d4729

Browse files
authored
fix(types): satisfy lint rule no-unsafe-function-type
Latest linting rule no-unsafe-function-type breaks existing types which results in failed CI checks on every other PR.
1 parent 628e1d9 commit 59d4729

8 files changed

+16
-16
lines changed

types/fomantic-ui-dropdown.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ declare namespace FomanticUI {
2929
* If a function is provided to callback, it's called after the dropdown-menu is shown.
3030
* Set preventFocus to true if you don't want the dropdown field to focus after the menu is shown
3131
*/
32-
(behavior: 'show', callback?: Function, preventFocus?: boolean): void;
32+
(behavior: 'show', callback?: () => void, preventFocus?: boolean): void;
3333

3434
/**
3535
* Hides dropdown.
3636
* If a function is provided to callback, it's called after the dropdown-menu is hidden.
3737
* Set preventBlur to true if you don't want the dropdown field to blur after the menu is hidden
3838
*/
39-
(behavior: 'hide', callback?: Function, preventBlur?: boolean): void;
39+
(behavior: 'hide', callback?: () => void, preventBlur?: boolean): void;
4040

4141
/**
4242
* Clears dropdown of selection.
@@ -358,7 +358,7 @@ declare namespace FomanticUI {
358358
* Whether to sort values when creating a dropdown automatically from a select element.
359359
* @default false
360360
*/
361-
sortSelect: boolean | 'natural' | Function;
361+
sortSelect: boolean | 'natural' | ((a: any, b: any) => number);
362362

363363
/**
364364
* Whether search selection will force currently selected choice when element is blurred.

types/fomantic-ui-flyout.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ declare namespace FomanticUI {
66
* Attaches flyout action to given selector.
77
* Default event if none specified is toggle.
88
*/
9-
(behavior: 'attach events', selector: JQuery, event: Function): JQuery;
9+
(behavior: 'attach events', selector: JQuery, event?: string): JQuery;
1010

1111
/**
1212
* Shows the flyout.

types/fomantic-ui-form.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ declare namespace FomanticUI {
164164
(settings?: Partial<Pick<FormSettings, keyof FormSettings>>): JQuery;
165165
}
166166

167-
type FormFields = Record<string, FormField | string[] | string | {}>;
167+
type FormFields = Record<string, FormField | string[] | string | object>;
168168

169169
interface FormRule {
170170
type: string;

types/fomantic-ui-modal.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ declare namespace FomanticUI {
55
/**
66
* Shows the modal.
77
*/
8-
(behavior: 'show', callback?: Function): JQuery;
8+
(behavior: 'show', callback?: () => void): JQuery;
99

1010
/**
1111
* Hides the modal.
1212
*/
13-
(behavior: 'hide', callback?: Function): JQuery;
13+
(behavior: 'hide', callback?: () => void): JQuery;
1414

1515
/**
1616
* Toggles the modal.

types/fomantic-ui-search.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ declare namespace FomanticUI {
55
/**
66
* Search for value currently set in search input.
77
*/
8-
(behavior: 'query', callback: Function): JQuery;
8+
(behavior: 'query', callback?: () => void): JQuery;
99

1010
/**
1111
* Displays message in search results with text, using template matching type.
@@ -30,7 +30,7 @@ declare namespace FomanticUI {
3030
/**
3131
* Search remote endpoint for specified query and display results.
3232
*/
33-
(behavior: 'search remote', query: string, callback: Function): JQuery;
33+
(behavior: 'search remote', query: string, callback?: () => void): JQuery;
3434

3535
/**
3636
* Search object for specified query and return results.
@@ -90,17 +90,17 @@ declare namespace FomanticUI {
9090
/**
9191
* Shows results container.
9292
*/
93-
(behavior: 'show results', callback: Function): JQuery;
93+
(behavior: 'show results', callback?: () => void): JQuery;
9494

9595
/**
9696
* Hide results container.
9797
*/
98-
(behavior: 'hide results', callback: Function): JQuery;
98+
(behavior: 'hide results', callback?: () => void): JQuery;
9999

100100
/**
101101
* Generates results using parser specified by 'settings.template'.
102102
*/
103-
(behavior: 'generate results', response: Function): JQuery;
103+
(behavior: 'generate results', response: object): JQuery;
104104

105105
/**
106106
* Removes all events.

types/fomantic-ui-slider.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ declare namespace FomanticUI {
8989
* You can specify a function here which consumes the current label value as parameter and should return a custom label text according to the given value.
9090
* @default false
9191
*/
92-
interpretLabel: false | Function;
92+
interpretLabel: false | ((value: any) => string);
9393

9494
/**
9595
* Show ticks on a labeled slider.

types/fomantic-ui-tab.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ declare namespace FomanticUI {
276276
* Returns page title
277277
* @default Function
278278
*/
279-
determineTitle: Function;
279+
determineTitle: (tabPath: string) => string | void;
280280
}
281281

282282
interface Selectors {

types/fomantic-ui-transition.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ declare namespace FomanticUI {
227227
* Callback right before the show transition should start.
228228
* The 'showFunction' parameter has to be called inside the callback to trigger the transition show
229229
*/
230-
onBeforeShow(this: JQuery, showFunction: Function): void;
230+
onBeforeShow(this: JQuery, showFunction: () => void): void;
231231

232232
/**
233233
* Callback once the show transition has finished.
@@ -244,7 +244,7 @@ declare namespace FomanticUI {
244244
* Callback right before the hide transition should start.
245245
* The 'hideFunction' parameter has to be called inside the callback to trigger the transition hide.
246246
*/
247-
onBeforeHide(this: JQuery, hideFunction: Function): void;
247+
onBeforeHide(this: JQuery, hideFunction: () => void): void;
248248

249249
/**
250250
* Callback once the transition hide has finished.

0 commit comments

Comments
 (0)