Add missing return types for function parameters in ui/
These are required for the upcoming TypeScript 3.9.2 upgrade.
[email protected]
Bug: 1011811
Change-Id: Ibb7000f4c70863549bf6ce160a9fb89cb163e6f7
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2199122
Commit-Queue: Jack Franklin <[email protected]>
Reviewed-by: Jack Franklin <[email protected]>
Auto-Submit: Tim van der Lippe <[email protected]>
diff --git a/front_end/ui/Context.js b/front_end/ui/Context.js
index d84f3c2..fc79dc6 100644
--- a/front_end/ui/Context.js
+++ b/front_end/ui/Context.js
@@ -18,7 +18,7 @@
}
/**
- * @param {function(new:T, ...)} flavorType
+ * @param {function(new:T, ...):void} flavorType
* @param {?T} flavorValue
* @template T
*/
@@ -37,7 +37,7 @@
}
/**
- * @param {function(new:T, ...)} flavorType
+ * @param {function(new:T, ...):void} flavorType
* @param {?T} flavorValue
* @template T
*/
@@ -56,8 +56,8 @@
}
/**
- * @param {function(new:Object, ...)} flavorType
- * @param {function(!Common.EventTarget.EventTargetEvent)} listener
+ * @param {function(new:Object, ...):void} flavorType
+ * @param {function(!Common.EventTarget.EventTargetEvent):*} listener
* @param {!Object=} thisObject
*/
addFlavorChangeListener(flavorType, listener, thisObject) {
@@ -70,8 +70,8 @@
}
/**
- * @param {function(new:Object, ...)} flavorType
- * @param {function(!Common.EventTarget.EventTargetEvent)} listener
+ * @param {function(new:Object, ...):void} flavorType
+ * @param {function(!Common.EventTarget.EventTargetEvent):*} listener
* @param {!Object=} thisObject
*/
removeFlavorChangeListener(flavorType, listener, thisObject) {
@@ -86,7 +86,7 @@
}
/**
- * @param {function(new:T, ...)} flavorType
+ * @param {function(new:T, ...):void} flavorType
* @return {?T}
* @template T
*/
diff --git a/front_end/ui/ContextMenu.js b/front_end/ui/ContextMenu.js
index 886a89e..19b9b6d 100644
--- a/front_end/ui/ContextMenu.js
+++ b/front_end/ui/ContextMenu.js
@@ -134,7 +134,7 @@
/**
* @param {string} label
- * @param {function(?)} handler
+ * @param {function(?):*} handler
* @param {boolean=} disabled
* @return {!Item}
*/
@@ -202,7 +202,7 @@
/**
* @param {string} label
- * @param {function()} handler
+ * @param {function():*} handler
* @param {boolean=} checked
* @param {boolean=} disabled
* @return {!Item}
@@ -510,7 +510,7 @@
/**
* @param {number} id
- * @param {function(?)} handler
+ * @param {function(?):*} handler
*/
_setHandler(id, handler) {
if (handler) {
diff --git a/front_end/ui/DropTarget.js b/front_end/ui/DropTarget.js
index e77da39..fe99e77 100644
--- a/front_end/ui/DropTarget.js
+++ b/front_end/ui/DropTarget.js
@@ -15,7 +15,7 @@
* @param {!Element} element
* @param {!Array<{kind: string, type: !RegExp}>} transferTypes
* @param {string} messageText
- * @param {function(!DataTransfer)} handleDrop
+ * @param {function(!DataTransfer):*} handleDrop
*/
constructor(element, transferTypes, messageText, handleDrop) {
element.addEventListener('dragenter', this._onDragEnter.bind(this), true);
diff --git a/front_end/ui/FilterSuggestionBuilder.js b/front_end/ui/FilterSuggestionBuilder.js
index e9fd147..9f609d4 100644
--- a/front_end/ui/FilterSuggestionBuilder.js
+++ b/front_end/ui/FilterSuggestionBuilder.js
@@ -10,7 +10,7 @@
export class FilterSuggestionBuilder {
/**
* @param {!Array<string>} keys
- * @param {function(string, !Array<string>)=} valueSorter
+ * @param {function(string, !Array<string>):void=} valueSorter
*/
constructor(keys, valueSorter) {
this._keys = keys;
diff --git a/front_end/ui/GlassPane.js b/front_end/ui/GlassPane.js
index 5a5598f..83eeb35 100644
--- a/front_end/ui/GlassPane.js
+++ b/front_end/ui/GlassPane.js
@@ -79,7 +79,7 @@
}
/**
- * @param {?function(!Event)} callback
+ * @param {?function(!Event):void} callback
*/
setOutsideClickCallback(callback) {
this._onClickOutsideCallback = callback;
diff --git a/front_end/ui/Infobar.js b/front_end/ui/Infobar.js
index 2425f19..c4f15f7 100644
--- a/front_end/ui/Infobar.js
+++ b/front_end/ui/Infobar.js
@@ -90,7 +90,7 @@
}
});
- /** @type {?function():void} */
+ /** @type {?function():*} */
this._closeCallback = null;
}
@@ -125,7 +125,7 @@
}
/**
- * @param {?function()} callback
+ * @param {?function():*} callback
*/
setCloseCallback(callback) {
this._closeCallback = callback;
@@ -140,7 +140,7 @@
/**
* @param {!InfobarAction} action
- * @returns {!function()}
+ * @returns {!function():void}
*/
_actionCallbackFactory(action) {
if (!action.delegate) {
@@ -191,7 +191,7 @@
/** @typedef {{
* text: !string,
* highlight: !boolean,
- * delegate: ?function(),
+ * delegate: ?function():void,
* dismiss: !boolean
* }}
*/
diff --git a/front_end/ui/InplaceEditor.js b/front_end/ui/InplaceEditor.js
index 5e6c8b6..c4c71e3 100644
--- a/front_end/ui/InplaceEditor.js
+++ b/front_end/ui/InplaceEditor.js
@@ -219,8 +219,8 @@
*/
export class Config {
/**
- * @param {function(!Element,string,string,T,string)} commitHandler
- * @param {function(!Element,T)} cancelHandler
+ * @param {function(!Element,string,string,T,string):void} commitHandler
+ * @param {function(!Element,T):void} cancelHandler
* @param {T=} context
* @param {function(!Element,!Event):boolean=} blurHandler
*/
@@ -254,6 +254,6 @@
}
/**
- * @typedef {{cancel: function(), commit: function()}}
+ * @typedef {{cancel: function():void, commit: function():void}}
*/
export let Controller;
diff --git a/front_end/ui/ListWidget.js b/front_end/ui/ListWidget.js
index 55d736e..51f15af 100644
--- a/front_end/ui/ListWidget.js
+++ b/front_end/ui/ListWidget.js
@@ -315,7 +315,7 @@
/**
* @param {function(!Event):boolean} predicate
- * @param {function()} callback
+ * @param {function():void} callback
* @param {!Event} event
*/
function onKeyDown(predicate, callback, event) {
@@ -433,8 +433,8 @@
* @param {!T} item
* @param {number} index
* @param {string} commitButtonTitle
- * @param {function()} commit
- * @param {function()} cancel
+ * @param {function():void} commit
+ * @param {function():void} cancel
*/
beginEdit(item, index, commitButtonTitle, commit, cancel) {
this._commit = commit;
diff --git a/front_end/ui/PopoverHelper.js b/front_end/ui/PopoverHelper.js
index 2035f1a..0ddc8f6 100644
--- a/front_end/ui/PopoverHelper.js
+++ b/front_end/ui/PopoverHelper.js
@@ -283,5 +283,5 @@
}
}
-/** @typedef {{box: !AnchorBox, show:(function(!GlassPane):!Promise<boolean>), hide:(function()|undefined)}} */
+/** @typedef {{box: !AnchorBox, show:(function(!GlassPane):!Promise<boolean>), hide:(function():void|undefined)}} */
export let PopoverRequest;
diff --git a/front_end/ui/ResizerWidget.js b/front_end/ui/ResizerWidget.js
index 418c642..dd1352a 100644
--- a/front_end/ui/ResizerWidget.js
+++ b/front_end/ui/ResizerWidget.js
@@ -105,8 +105,9 @@
if (!this._elements.has(element)) {
return false;
}
- elementDragStart(
- element, this._dragStart.bind(this), this._drag.bind(this), this._dragEnd.bind(this), this.cursor(), event);
+ elementDragStart(element, this._dragStart.bind(this), event => {
+ this._drag(event);
+ }, this._dragEnd.bind(this), this.cursor(), event);
}
/**
diff --git a/front_end/ui/SoftContextMenu.js b/front_end/ui/SoftContextMenu.js
index 0943257..153b668 100644
--- a/front_end/ui/SoftContextMenu.js
+++ b/front_end/ui/SoftContextMenu.js
@@ -44,7 +44,7 @@
export class SoftContextMenu {
/**
* @param {!Array.<!InspectorFrontendHostAPI.ContextMenuDescriptor>} items
- * @param {function(string)} itemSelectedCallback
+ * @param {function(string):void} itemSelectedCallback
* @param {!SoftContextMenu=} parentMenu
*/
constructor(items, itemSelectedCallback, parentMenu) {
diff --git a/front_end/ui/SplitWidget.js b/front_end/ui/SplitWidget.js
index fbe57a0..cca3dda 100644
--- a/front_end/ui/SplitWidget.js
+++ b/front_end/ui/SplitWidget.js
@@ -573,7 +573,7 @@
/**
* @param {boolean} reverse
- * @param {function()=} callback
+ * @param {function():void=} callback
*/
_animate(reverse, callback) {
const animationTime = 50;
diff --git a/front_end/ui/TargetCrashedScreen.js b/front_end/ui/TargetCrashedScreen.js
index 42608ce..467ef3a 100644
--- a/front_end/ui/TargetCrashedScreen.js
+++ b/front_end/ui/TargetCrashedScreen.js
@@ -10,7 +10,7 @@
export class TargetCrashedScreen extends VBox {
/**
- * @param {function()} hideCallback
+ * @param {function():*} hideCallback
*/
constructor(hideCallback) {
super(true);
diff --git a/front_end/ui/TextEditor.js b/front_end/ui/TextEditor.js
index f07d9dd..f46b403 100644
--- a/front_end/ui/TextEditor.js
+++ b/front_end/ui/TextEditor.js
@@ -81,7 +81,7 @@
}
/**
- * @param {function(!KeyboardEvent)} handler
+ * @param {function(!KeyboardEvent):void} handler
*/
addKeyDownHandler(handler) {
}
diff --git a/front_end/ui/TextPrompt.js b/front_end/ui/TextPrompt.js
index 06196d6..74d7a05 100644
--- a/front_end/ui/TextPrompt.js
+++ b/front_end/ui/TextPrompt.js
@@ -67,7 +67,7 @@
}
/**
- * @param {(function(this:null, string, string, boolean=):!Promise<!Suggestions>)} completions
+ * @param {function(this:null, string, string, boolean=):!Promise<!Suggestions>} completions
* @param {string=} stopCharacters
*/
initialize(completions, stopCharacters) {
@@ -104,7 +104,7 @@
* (since the "blur" event does not bubble.)
*
* @param {!Element} element
- * @param {function(!Event)} blurListener
+ * @param {function(!Event):*} blurListener
* @return {!Element}
*/
attachAndStartEditing(element, blurListener) {
@@ -263,7 +263,7 @@
}
/**
- * @param {function(!Event)=} blurListener
+ * @param {function(!Event):*=} blurListener
*/
_startEditing(blurListener) {
this._isEditing = true;
diff --git a/front_end/ui/Toolbar.js b/front_end/ui/Toolbar.js
index d36ed7d..e51489f 100644
--- a/front_end/ui/Toolbar.js
+++ b/front_end/ui/Toolbar.js
@@ -794,7 +794,7 @@
*/
export class ToolbarMenuButton extends ToolbarButton {
/**
- * @param {function(!ContextMenu)} contextMenuHandler
+ * @param {function(!ContextMenu):void} contextMenuHandler
* @param {boolean=} useSoftMenu
*/
constructor(contextMenuHandler, useSoftMenu) {
@@ -922,7 +922,7 @@
*/
export class ToolbarComboBox extends ToolbarItem {
/**
- * @param {?function(!Event)} changeHandler
+ * @param {?function(!Event):void} changeHandler
* @param {string} title
* @param {string=} className
*/
@@ -1125,7 +1125,7 @@
/**
* @param {string} text
* @param {string=} tooltip
- * @param {function()=} listener
+ * @param {function():void=} listener
*/
constructor(text, tooltip, listener) {
super(CheckboxLabel.create(text));
diff --git a/front_end/ui/UIUtils.js b/front_end/ui/UIUtils.js
index b86f395..16378d5 100644
--- a/front_end/ui/UIUtils.js
+++ b/front_end/ui/UIUtils.js
@@ -60,8 +60,8 @@
/**
* @param {!Element} element
* @param {?function(!MouseEvent): boolean} elementDragStart
- * @param {function(!MouseEvent)} elementDrag
- * @param {?function(!MouseEvent)} elementDragEnd
+ * @param {function(!MouseEvent):void} elementDrag
+ * @param {?function(!MouseEvent):void} elementDragEnd
* @param {?string} cursor
* @param {?string=} hoverCursor
* @param {number=} startDelay
@@ -102,8 +102,8 @@
/**
* @param {!Element} targetElement
* @param {?function(!MouseEvent):boolean} elementDragStart
- * @param {function(!MouseEvent)} elementDrag
- * @param {?function(!MouseEvent)} elementDragEnd
+ * @param {function(!MouseEvent):void} elementDrag
+ * @param {?function(!MouseEvent):void} elementDragEnd
* @param {?string} cursor
* @param {!Event} event
*/
@@ -147,8 +147,8 @@
/**
* @param {!Element} targetElement
* @param {?function(!MouseEvent):boolean} elementDragStart
- * @param {function(!MouseEvent)} elementDrag
- * @param {?function(!MouseEvent)} elementDragEnd
+ * @param {function(!MouseEvent):void} elementDrag
+ * @param {?function(!MouseEvent):void} elementDragEnd
* @param {?string} cursor
* @param {!Event} event
*/
@@ -508,8 +508,8 @@
/**
* @param {!Event} event
* @param {!Element} element
- * @param {function(string,string)=} finishHandler
- * @param {function(string)=} suggestionHandler
+ * @param {function(string,string):void=} finishHandler
+ * @param {(function(string):*)=} suggestionHandler
* @param {function(string, number, string):string=} customNumberHandler
* @return {boolean}
*/
@@ -1011,7 +1011,7 @@
/**
* @param {!Object} object
- * @param {function()} method
+ * @param {function():void} method
*/
add(object, method) {
if (!this._handlers) {
@@ -1067,7 +1067,7 @@
/**
* @param {!Object} object
- * @param {function()} method
+ * @param {function():void} method
*/
export function invokeOnceAfterBatchUpdate(object, method) {
if (!_postUpdateHandlers) {
@@ -1081,8 +1081,8 @@
* @param {!Function} func
* @param {!Array.<{from:number, to:number}>} params
* @param {number} duration
- * @param {function()=} animationComplete
- * @return {function()}
+ * @param {function():*=} animationComplete
+ * @return {function():void}
*/
export function animateFunction(window, func, params, duration, animationComplete) {
const start = window.performance.now();
@@ -1107,8 +1107,8 @@
export class LongClickController extends Common.ObjectWrapper.ObjectWrapper {
/**
* @param {!Element} element
- * @param {function(!Event)} callback
- * @param {function(!Event)} isEditKeyFunc
+ * @param {function(!Event):void} callback
+ * @param {function(!Event):void} isEditKeyFunc
*/
constructor(element, callback, isEditKeyFunc = event => isEnterOrSpaceKey(event)) {
super();
@@ -1248,7 +1248,7 @@
/**
* @param {string} text
- * @param {function(!Event)=} clickHandler
+ * @param {function(!Event):*=} clickHandler
* @param {string=} className
* @param {boolean=} primary
* @return {!Element}
@@ -1567,11 +1567,11 @@
/**
* @param {!Element} input
- * @param {function(string)} apply
+ * @param {function(string):void} apply
* @param {function(string):{valid: boolean, errorMessage: (string|undefined)}} validate
* @param {boolean} numeric
* @param {number=} modifierMultiplier
- * @return {function(string)}
+ * @return {function(string):void}
*/
export function bindInput(input, apply, validate, numeric, modifierMultiplier) {
input.addEventListener('change', onChange, false);
@@ -2085,7 +2085,7 @@
}
/**
- * @param {function(!File)} callback
+ * @param {function(!File):*} callback
* @return {!Node}
*/
export function createFileSelectorElement(callback) {
diff --git a/front_end/ui/ViewManager.js b/front_end/ui/ViewManager.js
index 302ba26..5c4738f 100644
--- a/front_end/ui/ViewManager.js
+++ b/front_end/ui/ViewManager.js
@@ -148,7 +148,7 @@
}
/**
- * @param {function()=} revealCallback
+ * @param {function():void=} revealCallback
* @param {string=} location
* @param {boolean=} restoreSelection
* @param {boolean=} allowReorder
@@ -160,7 +160,7 @@
}
/**
- * @param {function()=} revealCallback
+ * @param {function():void=} revealCallback
* @param {string=} location
* @return {!ViewLocation}
*/
@@ -382,7 +382,7 @@
/**
* @param {!ViewManager} manager
* @param {!Widget} widget
- * @param {function()=} revealCallback
+ * @param {function():void=} revealCallback
*/
constructor(manager, widget, revealCallback) {
this._manager = manager;
@@ -413,7 +413,7 @@
export class _TabbedLocation extends _Location {
/**
* @param {!ViewManager} manager
- * @param {function()=} revealCallback
+ * @param {function():void=} revealCallback
* @param {string=} location
* @param {boolean=} restoreSelection
* @param {boolean=} allowReorder
@@ -679,7 +679,7 @@
class _StackLocation extends _Location {
/**
* @param {!ViewManager} manager
- * @param {function()=} revealCallback
+ * @param {function():void=} revealCallback
* @param {string=} location
*/
constructor(manager, revealCallback, location) {
diff --git a/front_end/ui/Widget.js b/front_end/ui/Widget.js
index 8c86d3f..2e2fc1e 100644
--- a/front_end/ui/Widget.js
+++ b/front_end/ui/Widget.js
@@ -166,7 +166,7 @@
}
/**
- * @param {function(this:Widget)} method
+ * @param {function(this:Widget):void} method
*/
_callOnVisibleChildren(method) {
const copy = this._children.slice();
@@ -218,7 +218,7 @@
}
/**
- * @param {function(this:Widget)} notification
+ * @param {function(this:Widget):void} notification
*/
_notify(notification) {
++this._notificationDepth;
@@ -718,7 +718,7 @@
*/
export class VBoxWithResizeCallback extends VBox {
/**
- * @param {function()} resizeCallback
+ * @param {function():void} resizeCallback
*/
constructor(resizeCallback) {
super();
diff --git a/front_end/ui/XWidget.js b/front_end/ui/XWidget.js
index db310c7d..c830788 100644
--- a/front_end/ui/XWidget.js
+++ b/front_end/ui/XWidget.js
@@ -63,21 +63,21 @@
}
/**
- * @param {?function()} callback
+ * @param {?function():void} callback
*/
setOnShown(callback) {
this._onShownCallback = callback;
}
/**
- * @param {?function()} callback
+ * @param {?function():void} callback
*/
setOnHidden(callback) {
this._onHiddenCallback = callback;
}
/**
- * @param {?function()} callback
+ * @param {?function():void} callback
*/
setOnResized(callback) {
this._onResizedCallback = callback;
diff --git a/front_end/ui/ui.js b/front_end/ui/ui.js
index 5433a5e..4e4ae3b 100644
--- a/front_end/ui/ui.js
+++ b/front_end/ui/ui.js
@@ -65,7 +65,7 @@
import * as XWidget from './XWidget.js';
import * as ZoomManager from './ZoomManager.js';
-/** @typedef {{box: !AnchorBox, show:(function(!GlassPane.GlassPane):!Promise<boolean>), hide:(function()|undefined)}} */
+/** @typedef {{box: !AnchorBox, show:(function(!GlassPane.GlassPane):!Promise<boolean>), hide:(function():void|undefined)}} */
export let PopoverRequest;
export {
diff --git a/front_end/ui/utils/register-custom-element.js b/front_end/ui/utils/register-custom-element.js
index 46fc3e5..01f4cdf 100644
--- a/front_end/ui/utils/register-custom-element.js
+++ b/front_end/ui/utils/register-custom-element.js
@@ -8,8 +8,8 @@
/**
* @param {string} localName
* @param {string} typeExtension
- * @param {function(new:HTMLElement, *)} definition
- * @return {function()}
+ * @param {function(new:HTMLElement, *):void} definition
+ * @return {function():void}
* @suppressGlobalPropertiesCheck
*/
export function registerCustomElement(localName, typeExtension, definition) {