Skip to content

Commit

Permalink
small type cleanup: remove exclamation points (ampproject#37349)
Browse files Browse the repository at this point in the history
* smol type cleanup: remove exclamation points

* src/core

* keep rerunning
  • Loading branch information
samouri authored Jan 12, 2022
1 parent 631e5e4 commit cb17f8a
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 100 deletions.
12 changes: 6 additions & 6 deletions extensions/amp-carousel/0.1/carousel-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ export class CarouselControls {
* }} param0
*/
constructor({element, go, nextButton, prevButton}) {
/** @private @type {!AmpElement} */
/** @private @type {AmpElement} */
this.element_ = element;

/** @private @type {!GoFunctionDef} */
/** @private @type {GoFunctionDef} */
this.go_ = go;

/** @private @type {!Window} */
/** @private @type {Window} */
this.win_ = getWin(element);

/** @private {!HTMLDivElement} */
/** @private {HTMLDivElement} */
this.prevButton_ = prevButton;

/** @private {!HTMLDivElement} */
/** @private {HTMLDivElement} */
this.nextButton_ = nextButton;

/** @private {boolean} */
Expand Down Expand Up @@ -68,7 +68,7 @@ export class CarouselControls {
}

/**
* @param {!HTMLDivElement} button
* @param {HTMLDivElement} button
* @param {*} onInteraction
*/
setupButtonInteraction(button, onInteraction) {
Expand Down
12 changes: 6 additions & 6 deletions extensions/amp-carousel/0.1/scrollable-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {buildDom} from './build-dom';
const TAG = 'amp-scrollable-carousel';

export class AmpScrollableCarousel extends AMP.BaseElement {
/** @param {!AmpElement} element */
/** @param {AmpElement} element */
constructor(element) {
super(element);

Expand All @@ -24,7 +24,7 @@ export class AmpScrollableCarousel extends AMP.BaseElement {
/** @private {number} */
this.oldPos_ = 0;

/** @private {?Array<!Element>} */
/** @private {?Array<Element>} */
this.cells_ = null;

/** @private {?Element} */
Expand Down Expand Up @@ -153,7 +153,7 @@ export class AmpScrollableCarousel extends AMP.BaseElement {
this.commitSwitch_(newPos);
this.container_./*OK*/ scrollLeft = newPos;
} else {
/** @const {!TransitionDef<number>} */
/** @const {TransitionDef<number>} */
const interpolate = numeric(oldPos, newPos);
const duration = 200;
const curve = 'ease-in-out';
Expand Down Expand Up @@ -194,7 +194,7 @@ export class AmpScrollableCarousel extends AMP.BaseElement {
if (newPos == oldPos) {
return;
}
/** @const {!TransitionDef<number>} */
/** @const {TransitionDef<number>} */
const interpolate = numeric(oldPos, newPos);
const duration = 200;
const curve = 'ease-in-out';
Expand Down Expand Up @@ -242,7 +242,7 @@ export class AmpScrollableCarousel extends AMP.BaseElement {
* Escapes Left and Right arrow key events on the carousel container.
* This is to prevent them from doubly interacting with surrounding viewer
* contexts such as email clients when interacting with the amp-carousel.
* @param {!KeyboardEvent} event
* @param {KeyboardEvent} event
* @private
*/
keydownHandler_(event) {
Expand Down Expand Up @@ -321,7 +321,7 @@ export class AmpScrollableCarousel extends AMP.BaseElement {

/**
* @param {number} pos
* @param {function(!Element):void} callback
* @param {function(Element):void} callback
* @private
*/
withinWindow_(pos, callback) {
Expand Down
26 changes: 13 additions & 13 deletions extensions/amp-carousel/0.1/slidescroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const CUSTOM_SNAP_TIMEOUT = 100;
const TAG = 'AMP-CAROUSEL';

export class AmpSlideScroll extends AMP.BaseElement {
/** @param {!AmpElement} element */
/** @param {AmpElement} element */
constructor(element) {
super(element);

Expand All @@ -58,7 +58,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
/** @private {boolean} */
this.hasNativeSnapPoints_ = false;

/** @private {!Array<!Element>} */
/** @private {Array<Element>} */
this.slides_ = [];

/** @private {number} */
Expand All @@ -67,7 +67,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
/** @private {?Element} */
this.slidesContainer_ = null;

/** @private {!Array<!Element>} */
/** @private {Array<Element>} */
this.slideWrappers_ = [];

/** @private {boolean} */
Expand Down Expand Up @@ -132,7 +132,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
/** @private {number} */
this.previousScrollLeft_ = 0;

/** @private {!Array<?string>} */
/** @private {Array<?string>} */
this.dataSlideIdArr_ = [];

const platform = Services.platformFor(this.win);
Expand Down Expand Up @@ -527,7 +527,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
* Proceeds to the next slide in the desired direction.
* @param {number} dir -1 or 1
* @param {boolean} animate
* @param {!ActionTrust_Enum} trust
* @param {ActionTrust_Enum} trust
*/
moveSlide(dir, animate, trust) {
if (this.slideIndex_ !== null) {
Expand All @@ -552,7 +552,7 @@ export class AmpSlideScroll extends AMP.BaseElement {

/**
* Handles scroll on the slides container.
* @param {!Event} unusedEvent Event object.
* @param {Event} unusedEvent Event object.
* @private
*/
scrollHandler_(unusedEvent) {
Expand All @@ -577,7 +577,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
* Escapes Left and Right arrow key events on the carousel container.
* This is to prevent them from doubly interacting with surrounding viewer
* contexts such as email clients when interacting with the amp-carousel.
* @param {!KeyboardEvent} event
* @param {KeyboardEvent} event
* @private
*/
keydownHandler_(event) {
Expand Down Expand Up @@ -626,7 +626,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
* @param {number=} opt_forceDir if a valid direction is given force it to
* move 1 slide in that direction.
* @param {ActionTrust_Enum=} opt_trust
* @return {!Promise}
* @return {Promise}
*/
customSnap_(currentScrollLeft, opt_forceDir, opt_trust) {
this.snappingInProgress_ = true;
Expand Down Expand Up @@ -748,7 +748,7 @@ export class AmpSlideScroll extends AMP.BaseElement {
* Parses given value as integer and shows the slide with that index value
* when element has been laid out.
* @param {*} value
* @param {!ActionTrust_Enum} trust
* @param {ActionTrust_Enum} trust
*/
goToSlide(value, trust) {
const index = parseInt(value, 10);
Expand Down Expand Up @@ -921,7 +921,7 @@ export class AmpSlideScroll extends AMP.BaseElement {

/**
* Given an index, hides rest of the slides that are not needed.
* @param {!Array<number>} indexArr Array of indices that
* @param {Array<number>} indexArr Array of indices that
* should not be hidden.
* @private
*/
Expand Down Expand Up @@ -955,14 +955,14 @@ export class AmpSlideScroll extends AMP.BaseElement {
* Animate scrollLeft of the container.
* @param {number} fromScrollLeft
* @param {number} toScrollLeft
* @return {!Promise}
* @return {Promise}
* @private
*/
animateScrollLeft_(fromScrollLeft, toScrollLeft) {
if (fromScrollLeft == toScrollLeft) {
return Promise.resolve();
}
/** @const {!TransitionDef<number>} */
/** @const {TransitionDef<number>} */
const interpolate = numeric(fromScrollLeft, toScrollLeft);
const curve = bezierCurve(0.8, 0, 0.6, 1); // ease-in
const duration = 80;
Expand Down Expand Up @@ -1027,7 +1027,7 @@ export class AmpSlideScroll extends AMP.BaseElement {

/**
* @param {string} eventType
* @param {!JsonObject} vars A map of vars and their values.
* @param {JsonObject} vars A map of vars and their values.
* @private
*/
analyticsEvent_(eventType, vars) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describes.endtoend(
* A helper function for expecting an error from an async function since we
* don't have ChaiAsExpected and we cannot wait for errors from
* @param {function()} fn A function to run
* @param {!RegExp} regExp A regular expression to match the error message.
* @param {RegExp} regExp A regular expression to match the error message.
*/
async function expectAysncError(fn, regExp) {
let error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describes.endtoend(
/**
* Attach an event listener to page to capture the 'slideChange' event.
* If given a selector, click on it to fire the event being listened for.
* @return {!Promise}
* @return {Promise}
*/
function slideChangeEventAfterClicking(opt_selector) {
return controller.evaluate((opt_selector) => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-carousel/0.1/test/test-slidescroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describes.realWin(
* @param {boolean=} opt_attachToDom
* @param {boolean=} opt_hasAutoplay
* @param {boolean=} opt_autoplayLoops
* @return {!Element}
* @return {Element}
*/
function getAmpSlideScroll(
opt_hasLooping,
Expand Down
6 changes: 3 additions & 3 deletions extensions/amp-fit-text/0.1/amp-fit-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class AmpFitText extends AMP.BaseElement {
return true;
}

/** @param {!AmpElement} element */
/** @param {AmpElement} element */
constructor(element) {
super(element);

Expand Down Expand Up @@ -150,7 +150,7 @@ export class AmpFitText extends AMP.BaseElement {
* @param {number} minFontSize
* @param {number} maxFontSize
* @return {number}
* @private Visible for testing only!
* @private Visible for testing only
*/
export function calculateFontSize_(
measurer,
Expand Down Expand Up @@ -181,7 +181,7 @@ export function calculateFontSize_(
* @param {Element} measurer
* @param {number} maxHeight
* @param {number} fontSize
* @private Visible for testing only!
* @private Visible for testing only
*/
export function updateOverflow_(content, measurer, maxHeight, fontSize) {
setStyle(measurer, 'fontSize', px(fontSize));
Expand Down
4 changes: 2 additions & 2 deletions extensions/amp-fit-text/0.1/build-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export function queryDom(element) {
/**
* Make a destination node a clone of the source.
*
* @param {!Node} from
* @param {!Node} to
* @param {Node} from
* @param {Node} to
*/
export function mirrorNode(from, to) {
// First clear out the destination node.
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-fit-text/1.0/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {getWin} from '#core/window';
import {useCallback, useLayoutEffect, useRef} from '#preact';

/**
* @param {!BentoFitTextDef.Props} props
* @param {BentoFitTextDef.Props} props
* @return {PreactDef.Renderable}
*/
export function BentoFitText({
Expand Down
6 changes: 3 additions & 3 deletions src/core/context/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export class ContextNode {

/**
* @package
* @type {!Values}
* @type {Values}
*/
this.values = new Values(this);

Expand Down Expand Up @@ -267,7 +267,7 @@ export class ContextNode {
// Shadow root: track slot changes.
if (node.nodeType == FRAGMENT_NODE) {
node.addEventListener('slotchange', (e) => {
const slot = /** @type {!HTMLSlotElement} */ (e.target);
const slot = /** @type {HTMLSlotElement} */ (e.target);
// Rediscover newly assigned nodes.
slot.assignedNodes().forEach(discoverContained);
// Rediscover unassigned nodes.
Expand Down Expand Up @@ -308,7 +308,7 @@ export class ContextNode {
*/
setParent(parent) {
const parentContext = /** @type {*} */ (parent)?.nodeType
? ContextNode.get(/** @type {!Node} */ (parent))
? ContextNode.get(/** @type {Node} */ (parent))
: /** @type {?ContextNode<?>} */ (parent);
this.updateTree_(parentContext, /* parentOverridden */ parent != null);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/context/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function throttleTail(handler, defaultScheduler) {
scheduled = false;
handler();
};
/** @param {!SchedulerDef=} opt_scheduler */
/** @param {SchedulerDef=} opt_scheduler */
const scheduleIfNotScheduled = (opt_scheduler) => {
if (!scheduled) {
scheduled = true;
Expand Down
2 changes: 1 addition & 1 deletion src/preact/base-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ export class PreactBaseElement extends BaseElement {
* This has no effect on Bento documents, since they lack an Actions system.
* Instead, they should use `(await element.getApi()).action()`
* @param {string} alias
* @param {function(!API_TYPE, !../service/action-impl.ActionInvocation)} handler
* @param {function(API_TYPE, ../service/action-impl.ActionInvocation)} handler
* @param {../action-constants.ActionTrust_Enum} minTrust
* @protected
*/
Expand Down
8 changes: 4 additions & 4 deletions src/preact/bento-ce.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ if (typeof AMP !== 'undefined' && AMP.BaseElement) {
let ExtendableHTMLElement;
class CeBaseElement {
/**
* @param {!Element} element
* @param {Element} element
*/
constructor(element) {
/** @const {!Element} */
/** @const {Element} */
this.element = element;

/** @const {!Window} */
/** @const {Window} */
this.win = getWin(element);
}

Expand All @@ -59,7 +59,7 @@ if (typeof AMP !== 'undefined' && AMP.BaseElement) {
constructor() {
super();

/** @const {!CeBaseElement} */
/** @const {CeBaseElement} */
this.implementation = new BaseElement(this);
}

Expand Down
6 changes: 3 additions & 3 deletions src/preact/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function newDiff(vnode) {
*/
export function forwardRef(Component) {
/**
* @param {!Object} props
* @param {Object} props
* @return {R}
*/
function Forward(props) {
Expand Down Expand Up @@ -75,7 +75,7 @@ export function forwardRef(Component) {

/**
* @param {PreactDef.Renderable} children
* @return {!Array<PreactDef.Renderable>}
* @return {Array<PreactDef.Renderable>}
*/
function toArray(children) {
return toChildArray(children);
Expand All @@ -84,7 +84,7 @@ function toArray(children) {
/**
* @param {PreactDef.Renderable} children
* @param {function(PreactDef.Renderable):R} fn
* @return {!Array<R>}
* @return {Array<R>}
* @template R
*/
function map(children, fn) {
Expand Down
6 changes: 3 additions & 3 deletions src/preact/component/3p-frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '../../3p-frame';
import {parseUrlDeprecated} from '../../url';

/** @type {!Object<string,function():void>} 3p frames for that type. */
/** @type {Object<string,function():void>} 3p frames for that type. */
export const countGenerators = {};

// Block synchronous XHR in ad. These are very rare, but super bad for UX
Expand All @@ -40,8 +40,8 @@ const DEFAULT_SANDBOX =
/**
* Creates the iframe for the embed. Applies correct size and passes the embed
* attributes to the frame via JSON inside the fragment.
* @param {!IframeEmbedDef.Props} props
* @param {{current: (!IframeEmbedDef.Api|null)}} ref
* @param {IframeEmbedDef.Props} props
* @param {{current: (IframeEmbedDef.Api|null)}} ref
* @return {PreactDef.Renderable}
*/
function ProxyIframeEmbedWithRef(
Expand Down
Loading

0 comments on commit cb17f8a

Please sign in to comment.