chore(many): replace any types and add tech debt tickets (#26293)

Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
This commit is contained in:
Amanda Johnston
2023-01-06 09:34:55 -06:00
committed by GitHub
parent 27527025e4
commit c2e1ad385d
122 changed files with 229 additions and 65 deletions

View File

@ -6,6 +6,8 @@ import { Config } from './providers/config';
import { IonicWindow } from './types/interfaces'; import { IonicWindow } from './types/interfaces';
import { raf } from './util/util'; import { raf } from './util/util';
// TODO(FW-2827): types
export const appInitialize = (config: Config, doc: Document, zone: NgZone) => { export const appInitialize = (config: Config, doc: Document, zone: NgZone) => {
return (): any => { return (): any => {
const win: IonicWindow | undefined = doc.defaultView as any; const win: IonicWindow | undefined = doc.defaultView as any;

View File

@ -18,13 +18,13 @@ export class BooleanValueAccessorDirective extends ValueAccessor {
super(injector, el); super(injector, el);
} }
writeValue(value: any): void { writeValue(value: boolean): void {
this.el.nativeElement.checked = this.lastValue = value == null ? false : value; this.el.nativeElement.checked = this.lastValue = value == null ? false : value;
setIonicClasses(this.el); setIonicClasses(this.el);
} }
@HostListener('ionChange', ['$event.target']) @HostListener('ionChange', ['$event.target'])
_handleIonChange(el: any): void { _handleIonChange(el: HTMLIonCheckboxElement | HTMLIonToggleElement): void {
this.handleChangeEvent(el, el.checked); this.handleChangeEvent(el, el.checked);
} }
} }

View File

@ -19,6 +19,7 @@ export class RadioValueAccessorDirective extends ValueAccessor {
super(injector, el); super(injector, el);
} }
// TODO(FW-2827): type (HTMLIonRadioElement and HTMLElement are both missing `checked`)
@HostListener('ionSelect', ['$event.target']) @HostListener('ionSelect', ['$event.target'])
_handleIonSelect(el: any): void { _handleIonSelect(el: any): void {
this.handleChangeEvent(el, el.checked); this.handleChangeEvent(el, el.checked);

View File

@ -20,7 +20,14 @@ export class SelectValueAccessorDirective extends ValueAccessor {
} }
@HostListener('ionChange', ['$event.target']) @HostListener('ionChange', ['$event.target'])
_handleChangeEvent(el: any): void { _handleChangeEvent(
el:
| HTMLIonRangeElement
| HTMLIonSelectElement
| HTMLIonRadioGroupElement
| HTMLIonSegmentElement
| HTMLIonDatetimeElement
): void {
this.handleChangeEvent(el, el.value); this.handleChangeEvent(el, el.value);
} }
} }

View File

@ -20,7 +20,7 @@ export class TextValueAccessorDirective extends ValueAccessor {
} }
@HostListener('ionChange', ['$event.target']) @HostListener('ionChange', ['$event.target'])
_handleInputEvent(el: any): void { _handleInputEvent(el: HTMLIonInputElement | HTMLIonTextareaElement | HTMLIonSearchbarElement): void {
this.handleChangeEvent(el, el.value); this.handleChangeEvent(el, el.value);
} }
} }

View File

@ -4,6 +4,8 @@ import { Subscription } from 'rxjs';
import { raf } from '../../util/util'; import { raf } from '../../util/util';
// TODO(FW-2827): types
@Directive() @Directive()
export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDestroy { export class ValueAccessor implements ControlValueAccessor, AfterViewInit, OnDestroy {
private onChange: (value: any) => void = () => { private onChange: (value: any) => void = () => {

View File

@ -30,6 +30,8 @@ import { isComponentFactoryResolver } from '../../util/util';
import { StackController } from './stack-controller'; import { StackController } from './stack-controller';
import { RouteView, getUrl } from './stack-utils'; import { RouteView, getUrl } from './stack-utils';
// TODO(FW-2827): types
@Directive({ @Directive({
selector: 'ion-router-outlet', selector: 'ion-router-outlet',
exportAs: 'outlet', exportAs: 'outlet',

View File

@ -17,6 +17,8 @@ import {
toSegments, toSegments,
} from './stack-utils'; } from './stack-utils';
// TODO(FW-2827): types
export class StackController { export class StackController {
private views: RouteView[] = []; private views: RouteView[] = [];
private runningTask?: Promise<any>; private runningTask?: Promise<any>;

View File

@ -86,6 +86,7 @@ export interface StackEvent {
tabSwitch: boolean; tabSwitch: boolean;
} }
// TODO(FW-2827): types
export interface RouteView { export interface RouteView {
id: number; id: number;
url: string; url: string;

View File

@ -108,6 +108,7 @@ export declare interface IonModal extends Components.IonModal {
], ],
}) })
export class IonModal { export class IonModal {
// TODO(FW-2827): type
@ContentChild(TemplateRef, { static: false }) template: TemplateRef<any>; @ContentChild(TemplateRef, { static: false }) template: TemplateRef<any>;
isCmpOpen: boolean = false; isCmpOpen: boolean = false;

View File

@ -99,6 +99,7 @@ export declare interface IonPopover extends Components.IonPopover {
], ],
}) })
export class IonPopover { export class IonPopover {
// TODO(FW-2827): type
@ContentChild(TemplateRef, { static: false }) template: TemplateRef<any>; @ContentChild(TemplateRef, { static: false }) template: TemplateRef<any>;
isCmpOpen: boolean = false; isCmpOpen: boolean = false;

View File

@ -21,6 +21,8 @@ import { EnvironmentInjector } from '../di/r3_injector';
import { NavParams } from '../directives/navigation/nav-params'; import { NavParams } from '../directives/navigation/nav-params';
import { isComponentFactoryResolver } from '../util/util'; import { isComponentFactoryResolver } from '../util/util';
// TODO(FW-2827): types
@Injectable() @Injectable()
export class AngularDelegate { export class AngularDelegate {
constructor(private zone: NgZone, private appRef: ApplicationRef) {} constructor(private zone: NgZone, private appRef: ApplicationRef) {}

View File

@ -3,6 +3,8 @@ import { NgZone, Inject, Injectable } from '@angular/core';
import { BackButtonEventDetail, KeyboardEventDetail, Platforms, getPlatforms, isPlatform } from '@ionic/core'; import { BackButtonEventDetail, KeyboardEventDetail, Platforms, getPlatforms, isPlatform } from '@ionic/core';
import { Subscription, Subject } from 'rxjs'; import { Subscription, Subject } from 'rxjs';
// TODO(FW-2827): types
export interface BackButtonEmitter extends Subject<BackButtonEventDetail> { export interface BackButtonEmitter extends Subject<BackButtonEventDetail> {
subscribeWithPriority( subscribeWithPriority(
priority: number, priority: number,

View File

@ -4,6 +4,8 @@ import { parse } from 'jsonc-parser';
const CONFIG_PATH = 'angular.json'; const CONFIG_PATH = 'angular.json';
// TODO(FW-2827): types
export function readConfig(host: Tree): any { export function readConfig(host: Tree): any {
const sourceText = host.read(CONFIG_PATH)?.toString('utf-8'); const sourceText = host.read(CONFIG_PATH)?.toString('utf-8');
return JSON.parse(sourceText); return JSON.parse(sourceText);

View File

@ -1,5 +1,5 @@
export interface IonicGlobal { export interface IonicGlobal {
config?: any; config?: any; // TODO(FW-2827): type
asyncQueue?: boolean; asyncQueue?: boolean;
} }

View File

@ -1,3 +1,5 @@
// TODO(FW-2827): types
interface ControllerShape<Opts, HTMLElm> { interface ControllerShape<Opts, HTMLElm> {
create(options: Opts): Promise<HTMLElm>; create(options: Opts): Promise<HTMLElm>;
dismiss(data?: any, role?: string, id?: string): Promise<boolean>; dismiss(data?: any, role?: string, id?: string): Promise<boolean>;

View File

@ -30,7 +30,7 @@ export interface AlertInput {
type?: TextFieldTypes | 'checkbox' | 'radio' | 'textarea'; type?: TextFieldTypes | 'checkbox' | 'radio' | 'textarea';
name?: string; name?: string;
placeholder?: string; placeholder?: string;
value?: any; value?: any; // TODO(FW-2832): type
label?: string; label?: string;
checked?: boolean; checked?: boolean;
disabled?: boolean; disabled?: boolean;
@ -60,5 +60,6 @@ export interface AlertButton {
role?: 'cancel' | 'destructive' | string; role?: 'cancel' | 'destructive' | string;
cssClass?: string | string[]; cssClass?: string | string[];
id?: string; id?: string;
// TODO(FW-2832): type
handler?: (value: any) => AlertButtonOverlayHandler | Promise<AlertButtonOverlayHandler>; handler?: (value: any) => AlertButtonOverlayHandler | Promise<AlertButtonOverlayHandler>;
} }

View File

@ -25,6 +25,8 @@ import { iosLeaveAnimation } from './animations/ios.leave';
import { mdEnterAnimation } from './animations/md.enter'; import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave'; import { mdLeaveAnimation } from './animations/md.leave';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*/ */

View File

@ -10,7 +10,7 @@ import { isPlatform } from '../../utils/platform';
styleUrl: 'app.scss', styleUrl: 'app.scss',
}) })
export class App implements ComponentInterface { export class App implements ComponentInterface {
private focusVisible?: any; private focusVisible?: any; // TODO(FW-2832): type
@Element() el!: HTMLElement; @Element() el!: HTMLElement;

View File

@ -114,7 +114,7 @@ export class Checkbox implements ComponentInterface {
} }
} }
private onClick = (ev: any) => { private onClick = (ev: Event) => {
ev.preventDefault(); ev.preventDefault();
this.setFocus(); this.setFocus();

View File

@ -21,7 +21,7 @@ import { createColorClasses, hostContext } from '../../utils/theme';
shadow: true, shadow: true,
}) })
export class Content implements ComponentInterface { export class Content implements ComponentInterface {
private watchDog: any; private watchDog: ReturnType<typeof setInterval> | null = null;
private isScrolling = false; private isScrolling = false;
private lastScroll = 0; private lastScroll = 0;
private queued = false; private queued = false;
@ -311,7 +311,7 @@ export class Content implements ComponentInterface {
} }
private onScrollEnd() { private onScrollEnd() {
clearInterval(this.watchDog); if (this.watchDog) clearInterval(this.watchDog);
this.watchDog = null; this.watchDog = null;
if (this.isScrolling) { if (this.isScrolling) {
this.isScrolling = false; this.isScrolling = false;

View File

@ -95,6 +95,7 @@ export class Datetime implements ComponentInterface {
private destroyCalendarListener?: () => void; private destroyCalendarListener?: () => void;
private destroyKeyboardMO?: () => void; private destroyKeyboardMO?: () => void;
// TODO(FW-2832): types (DatetimeParts causes some errors that need untangling)
private minParts?: any; private minParts?: any;
private maxParts?: any; private maxParts?: any;
private todayParts!: DatetimeParts; private todayParts!: DatetimeParts;

View File

@ -20,7 +20,7 @@ import { handleFooterFade } from './footer.utils';
}) })
export class Footer implements ComponentInterface { export class Footer implements ComponentInterface {
private scrollEl?: HTMLElement; private scrollEl?: HTMLElement;
private contentScrollCallback: any; private contentScrollCallback?: () => void;
private keyboardCtrl: KeyboardController | null = null; private keyboardCtrl: KeyboardController | null = null;
@State() private keyboardVisible = false; @State() private keyboardVisible = false;

View File

@ -29,8 +29,8 @@ import {
}) })
export class Header implements ComponentInterface { export class Header implements ComponentInterface {
private scrollEl?: HTMLElement; private scrollEl?: HTMLElement;
private contentScrollCallback?: any; private contentScrollCallback?: () => void;
private intersectionObserver?: any; private intersectionObserver?: IntersectionObserver;
private collapsibleMainHeader?: HTMLElement; private collapsibleMainHeader?: HTMLElement;
private inheritedAttributes: Attributes = {}; private inheritedAttributes: Attributes = {};
@ -153,9 +153,9 @@ export class Header implements ComponentInterface {
this.scrollEl = await getScrollElement(contentEl); this.scrollEl = await getScrollElement(contentEl);
const headers = pageEl.querySelectorAll('ion-header'); const headers = pageEl.querySelectorAll('ion-header');
this.collapsibleMainHeader = Array.from(headers).find((header: any) => header.collapse !== 'condense') as this.collapsibleMainHeader = Array.from(headers).find(
| HTMLElement (header: HTMLIonHeaderElement) => header.collapse !== 'condense'
| undefined; ) as HTMLElement | undefined;
if (!this.collapsibleMainHeader) { if (!this.collapsibleMainHeader) {
return; return;
@ -177,7 +177,7 @@ export class Header implements ComponentInterface {
* as well as progressively showing/hiding the main header * as well as progressively showing/hiding the main header
* border as the top-most toolbar collapses or expands. * border as the top-most toolbar collapses or expands.
*/ */
const toolbarIntersection = (ev: any) => { const toolbarIntersection = (ev: IntersectionObserverEntry[]) => {
handleToolbarIntersection(ev, mainHeaderIndex, scrollHeaderIndex, this.scrollEl!); handleToolbarIntersection(ev, mainHeaderIndex, scrollHeaderIndex, this.scrollEl!);
}; };

View File

@ -40,7 +40,7 @@ export const createHeaderIndex = (headerEl: HTMLElement | undefined): HeaderInde
return { return {
el: headerEl, el: headerEl,
toolbars: Array.from(toolbars).map((toolbar: any) => { toolbars: Array.from(toolbars).map((toolbar: HTMLIonToolbarElement) => {
const ionTitleEl = toolbar.querySelector('ion-title'); const ionTitleEl = toolbar.querySelector('ion-title');
return { return {
el: toolbar, el: toolbar,
@ -86,7 +86,11 @@ export const setToolbarBackgroundOpacity = (headerEl: HTMLIonHeaderElement, opac
} }
}; };
const handleToolbarBorderIntersection = (ev: any, mainHeaderIndex: HeaderIndex, scrollTop: number) => { const handleToolbarBorderIntersection = (
ev: IntersectionObserverEntry[],
mainHeaderIndex: HeaderIndex,
scrollTop: number
) => {
if (!ev[0].isIntersecting) { if (!ev[0].isIntersecting) {
return; return;
} }
@ -113,7 +117,7 @@ const handleToolbarBorderIntersection = (ev: any, mainHeaderIndex: HeaderIndex,
* hide the primary toolbar content and show the scrollable toolbar content * hide the primary toolbar content and show the scrollable toolbar content
*/ */
export const handleToolbarIntersection = ( export const handleToolbarIntersection = (
ev: any, ev: any, // TODO(FW-2832): type (IntersectionObserverEntry[] triggers errors which should be sorted)
mainHeaderIndex: HeaderIndex, mainHeaderIndex: HeaderIndex,
scrollHeaderIndex: HeaderIndex, scrollHeaderIndex: HeaderIndex,
scrollEl: HTMLElement scrollEl: HTMLElement

View File

@ -24,7 +24,7 @@ export class ItemOptions implements ComponentInterface {
/** /**
* Emitted when the item has been fully swiped. * Emitted when the item has been fully swiped.
*/ */
@Event() ionSwipe!: EventEmitter<any>; @Event() ionSwipe!: EventEmitter<any>; // TODO(FW-2832): type
/** @internal */ /** @internal */
@Method() @Method()

View File

@ -39,7 +39,7 @@ export class ItemSliding implements ComponentInterface {
private optsWidthRightSide = 0; private optsWidthRightSide = 0;
private optsWidthLeftSide = 0; private optsWidthLeftSide = 0;
private sides = ItemSide.None; private sides = ItemSide.None;
private tmr: number | undefined; private tmr?: ReturnType<typeof setTimeout>;
private leftOptions?: HTMLIonItemOptionsElement; private leftOptions?: HTMLIonItemOptionsElement;
private rightOptions?: HTMLIonItemOptionsElement; private rightOptions?: HTMLIonItemOptionsElement;
private optsDirty = true; private optsDirty = true;
@ -418,7 +418,7 @@ export class ItemSliding implements ComponentInterface {
if (this.gesture) { if (this.gesture) {
this.gesture.enable(!this.disabled); this.gesture.enable(!this.disabled);
} }
}, 600) as any; }, 600);
openSlidingItem = undefined; openSlidingItem = undefined;
style.transform = ''; style.transform = '';

View File

@ -177,7 +177,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
const tagName = (ev.target as HTMLElement).tagName; const tagName = (ev.target as HTMLElement).tagName;
const updatedStyles = ev.detail; const updatedStyles = ev.detail;
const newStyles = {} as any; const newStyles = {} as CssClassMap;
const childStyles = this.itemStyles.get(tagName) || {}; const childStyles = this.itemStyles.get(tagName) || {};
let hasStyleChange = false; let hasStyleChange = false;
@ -364,7 +364,7 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
routerDirection, routerDirection,
inheritedAriaAttributes, inheritedAriaAttributes,
} = this; } = this;
const childStyles = {} as any; const childStyles = {} as StyleEventDetail;
const mode = getIonMode(this); const mode = getIonMode(this);
const clickable = this.isClickable(); const clickable = this.isClickable();
const canActivate = this.canActivate(); const canActivate = this.canActivate();

View File

@ -20,6 +20,8 @@ import { iosLeaveAnimation } from './animations/ios.leave';
import { mdEnterAnimation } from './animations/md.enter'; import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave'; import { mdLeaveAnimation } from './animations/md.leave';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*/ */
@ -32,7 +34,7 @@ import { mdLeaveAnimation } from './animations/md.leave';
scoped: true, scoped: true,
}) })
export class Loading implements ComponentInterface, OverlayInterface { export class Loading implements ComponentInterface, OverlayInterface {
private durationTimeout: any; private durationTimeout?: ReturnType<typeof setTimeout>;
presented = false; presented = false;
lastFocus?: HTMLElement; lastFocus?: HTMLElement;

View File

@ -31,7 +31,7 @@ const focusableQueryString =
shadow: true, shadow: true,
}) })
export class Menu implements ComponentInterface, MenuI { export class Menu implements ComponentInterface, MenuI {
private animation?: any; private animation?: any; // TODO(FW-2832): type
private lastOnEnd = 0; private lastOnEnd = 0;
private gesture?: Gesture; private gesture?: Gesture;
private blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true }); private blocker = GESTURE_CONTROLLER.createBlocker({ disableScroll: true });
@ -257,6 +257,7 @@ export class Menu implements ComponentInterface, MenuI {
@Listen('click', { capture: true }) @Listen('click', { capture: true })
onBackdropClick(ev: any) { onBackdropClick(ev: any) {
// TODO(FW-2832): type (CustomEvent triggers errors which should be sorted)
if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) { if (this._isOpen && this.lastOnEnd < ev.timeStamp - 100) {
const shouldClose = ev.composedPath ? !ev.composedPath().includes(this.menuInnerEl) : false; const shouldClose = ev.composedPath ? !ev.composedPath().includes(this.menuInnerEl) : false;

View File

@ -44,6 +44,8 @@ import { createSheetGesture } from './gestures/sheet';
import { createSwipeToCloseGesture } from './gestures/swipe-to-close'; import { createSwipeToCloseGesture } from './gestures/swipe-to-close';
import { setCardStatusBarDark, setCardStatusBarDefault } from './utils'; import { setCardStatusBarDark, setCardStatusBarDefault } from './utils';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* *

View File

@ -9,6 +9,8 @@ import type {
import { ViewController } from './view-controller'; import { ViewController } from './view-controller';
// TODO(FW-2832): types
export type NavDirection = 'back' | 'forward'; export type NavDirection = 'back' | 'forward';
export type NavComponent = ComponentRef | ViewController; export type NavComponent = ComponentRef | ViewController;

View File

@ -6,6 +6,8 @@ export const VIEW_STATE_NEW = 1;
export const VIEW_STATE_ATTACHED = 2; export const VIEW_STATE_ATTACHED = 2;
export const VIEW_STATE_DESTROYED = 3; export const VIEW_STATE_DESTROYED = 3;
// TODO(FW-2832): types
export class ViewController { export class ViewController {
state = VIEW_STATE_NEW; state = VIEW_STATE_NEW;
nav?: any; nav?: any;

View File

@ -111,6 +111,7 @@ export class PickerColumnInternal implements ComponentInterface {
const parentEl = this.el.closest('ion-picker-internal') as HTMLIonPickerInternalElement | null; const parentEl = this.el.closest('ion-picker-internal') as HTMLIonPickerInternalElement | null;
if (parentEl !== null) { if (parentEl !== null) {
// TODO(FW-2832): type
parentEl.addEventListener('ionInputModeChange', (ev: any) => this.inputModeChange(ev)); parentEl.addEventListener('ionInputModeChange', (ev: any) => this.inputModeChange(ev));
} }
} }
@ -231,7 +232,7 @@ export class PickerColumnInternal implements ComponentInterface {
private initializeScrollListener = () => { private initializeScrollListener = () => {
const { el } = this; const { el } = this;
let timeout: any; let timeout: ReturnType<typeof setTimeout> | undefined;
let activeEl: HTMLElement | null = this.activeItem; let activeEl: HTMLElement | null = this.activeItem;
const scrollCallback = () => { const scrollCallback = () => {

View File

@ -28,8 +28,8 @@ export class PickerColumnCmp implements ComponentInterface {
private y = 0; private y = 0;
private optsEl?: HTMLElement; private optsEl?: HTMLElement;
private gesture?: Gesture; private gesture?: Gesture;
private rafId: any; private rafId?: ReturnType<typeof requestAnimationFrame>;
private tmrId: any; private tmrId?: ReturnType<typeof setTimeout>;
private noAnimate = true; private noAnimate = true;
@Element() el!: HTMLElement; @Element() el!: HTMLElement;
@ -90,8 +90,8 @@ export class PickerColumnCmp implements ComponentInterface {
} }
disconnectedCallback() { disconnectedCallback() {
cancelAnimationFrame(this.rafId); if (this.rafId !== undefined) cancelAnimationFrame(this.rafId);
clearTimeout(this.tmrId); if (this.tmrId) clearTimeout(this.tmrId);
if (this.gesture) { if (this.gesture) {
this.gesture.destroy(); this.gesture.destroy();
this.gesture = undefined; this.gesture = undefined;
@ -110,7 +110,7 @@ export class PickerColumnCmp implements ComponentInterface {
this.velocity = 0; this.velocity = 0;
// set what y position we're at // set what y position we're at
cancelAnimationFrame(this.rafId); if (this.rafId !== undefined) cancelAnimationFrame(this.rafId);
this.update(y, duration, true); this.update(y, duration, true);
this.emitColChange(); this.emitColChange();
@ -251,7 +251,7 @@ export class PickerColumnCmp implements ComponentInterface {
hapticSelectionStart(); hapticSelectionStart();
// reset everything // reset everything
cancelAnimationFrame(this.rafId); if (this.rafId !== undefined) cancelAnimationFrame(this.rafId);
const options = this.col.options; const options = this.col.options;
let minY = options.length - 1; let minY = options.length - 1;
let maxY = 0; let maxY = 0;

View File

@ -24,7 +24,7 @@ export class PickerInternal implements ComponentInterface {
private highlightEl?: HTMLElement; private highlightEl?: HTMLElement;
private actionOnClick?: () => void; private actionOnClick?: () => void;
private destroyKeypressListener?: () => void; private destroyKeypressListener?: () => void;
private singleColumnSearchTimeout?: any; private singleColumnSearchTimeout?: ReturnType<typeof setTimeout>;
@Element() el!: HTMLIonPickerInternalElement; @Element() el!: HTMLIonPickerInternalElement;
@ -76,6 +76,7 @@ export class PickerInternal implements ComponentInterface {
* that focused means we are still in input mode. * that focused means we are still in input mode.
*/ */
private onFocusOut = (ev: any) => { private onFocusOut = (ev: any) => {
// TODO(FW-2832): type
const { relatedTarget } = ev; const { relatedTarget } = ev;
if (!relatedTarget || (relatedTarget.tagName !== 'ION-PICKER-COLUMN-INTERNAL' && relatedTarget !== this.inputEl)) { if (!relatedTarget || (relatedTarget.tagName !== 'ION-PICKER-COLUMN-INTERNAL' && relatedTarget !== this.inputEl)) {
@ -89,6 +90,7 @@ export class PickerInternal implements ComponentInterface {
* whether to enter/exit input mode. * whether to enter/exit input mode.
*/ */
private onFocusIn = (ev: any) => { private onFocusIn = (ev: any) => {
// TODO(FW-2832): type
const { target } = ev; const { target } = ev;
/** /**

View File

@ -17,6 +17,8 @@ import { getClassMap } from '../../utils/theme';
import { iosEnterAnimation } from './animations/ios.enter'; import { iosEnterAnimation } from './animations/ios.enter';
import { iosLeaveAnimation } from './animations/ios.leave'; import { iosLeaveAnimation } from './animations/ios.leave';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
*/ */
@ -29,7 +31,7 @@ import { iosLeaveAnimation } from './animations/ios.leave';
scoped: true, scoped: true,
}) })
export class Picker implements ComponentInterface, OverlayInterface { export class Picker implements ComponentInterface, OverlayInterface {
private durationTimeout: any; private durationTimeout?: ReturnType<typeof setTimeout>;
lastFocus?: HTMLElement; lastFocus?: HTMLElement;
@Element() el!: HTMLIonPickerElement; @Element() el!: HTMLIonPickerElement;

View File

@ -14,6 +14,7 @@ const POPOVER_IOS_BODY_PADDING = 5;
/** /**
* iOS Popover Enter Animation * iOS Popover Enter Animation
*/ */
// TODO(FW-2832): types
export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation => { export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation => {
const { event: ev, size, trigger, reference, side, align } = opts; const { event: ev, size, trigger, reference, side, align } = opts;
const doc = baseEl.ownerDocument as any; const doc = baseEl.ownerDocument as any;

View File

@ -8,6 +8,7 @@ const POPOVER_MD_BODY_PADDING = 12;
/** /**
* Md Popover Enter Animation * Md Popover Enter Animation
*/ */
// TODO(FW-2832): types
export const mdEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation => { export const mdEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation => {
const { event: ev, size, trigger, reference, side, align } = opts; const { event: ev, size, trigger, reference, side, align } = opts;
const doc = baseEl.ownerDocument as any; const doc = baseEl.ownerDocument as any;

View File

@ -29,6 +29,8 @@ import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave'; import { mdLeaveAnimation } from './animations/md.leave';
import { configureDismissInteraction, configureKeyboardInteraction, configureTriggerInteraction } from './utils'; import { configureDismissInteraction, configureKeyboardInteraction, configureTriggerInteraction } from './utils';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* *

View File

@ -3,7 +3,7 @@ import { getElementRoot, raf } from '../../utils/helpers';
interface InteractionCallback { interface InteractionCallback {
eventName: string; eventName: string;
callback: (ev: any) => void; callback: (ev: any) => void; // TODO(FW-2832): type
} }
export interface ReferenceCoordinates { export interface ReferenceCoordinates {
@ -169,7 +169,7 @@ export const configureTriggerInteraction = (
*/ */
switch (triggerAction) { switch (triggerAction) {
case 'hover': case 'hover':
let hoverTimeout: any; let hoverTimeout: ReturnType<typeof setTimeout> | undefined;
triggerCallbacks = [ triggerCallbacks = [
{ {

View File

@ -105,6 +105,7 @@ export class RadioGroup implements ComponentInterface {
@Listen('keydown', { target: 'document' }) @Listen('keydown', { target: 'document' })
onKeydown(ev: any) { onKeydown(ev: any) {
// TODO(FW-2832): type
const inSelectPopover = !!this.el.closest('ion-select-popover'); const inSelectPopover = !!this.el.closest('ion-select-popover');
if (ev.target && !this.el.contains(ev.target)) { if (ev.target && !this.el.contains(ev.target)) {

View File

@ -79,6 +79,7 @@ export class Radio implements ComponentInterface {
/** @internal */ /** @internal */
@Method() @Method()
async setFocus(ev: any) { async setFocus(ev: any) {
// TODO(FW-2832): type (using Event triggers a build error due to conflict with Stencil Event import)
ev.stopPropagation(); ev.stopPropagation();
ev.preventDefault(); ev.preventDefault();

View File

@ -22,6 +22,8 @@ import { createColorClasses, hostContext } from '../../utils/theme';
import type { PinFormatter } from './range-interface'; import type { PinFormatter } from './range-interface';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* *

View File

@ -37,7 +37,7 @@ export class Refresher implements ComponentInterface {
private progress = 0; private progress = 0;
private scrollEl?: HTMLElement; private scrollEl?: HTMLElement;
private backgroundContentEl?: HTMLElement; private backgroundContentEl?: HTMLElement;
private scrollListenerCallback?: any; private scrollListenerCallback?: () => void;
private gesture?: Gesture; private gesture?: Gesture;
private pointerDown = false; private pointerDown = false;

View File

@ -26,6 +26,7 @@ export const createPullingAnimation = (
}; };
const createBaseAnimation = (pullingRefresherIcon: HTMLElement) => { const createBaseAnimation = (pullingRefresherIcon: HTMLElement) => {
// TODO(FW-2832): add types/re-evaluate asserting so many things
const spinner = pullingRefresherIcon.querySelector('ion-spinner') as HTMLElement; const spinner = pullingRefresherIcon.querySelector('ion-spinner') as HTMLElement;
const circle = spinner!.shadowRoot!.querySelector('circle') as any; const circle = spinner!.shadowRoot!.querySelector('circle') as any;
const spinnerArrowContainer = pullingRefresherIcon.querySelector('.spinner-arrow-container') as HTMLElement; const spinnerArrowContainer = pullingRefresherIcon.querySelector('.spinner-arrow-container') as HTMLElement;

View File

@ -7,6 +7,8 @@ import { findClosestIonContent, getScrollElement } from '../../utils/content';
import { raf } from '../../utils/helpers'; import { raf } from '../../utils/helpers';
import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from '../../utils/native/haptic'; import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from '../../utils/native/haptic';
// TODO(FW-2832): types
const enum ReorderGroupState { const enum ReorderGroupState {
Idle = 0, Idle = 0,
Active = 1, Active = 1,

View File

@ -3,6 +3,8 @@ import { Component, Event, Prop, Watch } from '@stencil/core';
import type { NavigationHookCallback } from './route-interface'; import type { NavigationHookCallback } from './route-interface';
// TODO(FW-2832): types
@Component({ @Component({
tag: 'ion-route', tag: 'ion-route',
}) })

View File

@ -29,6 +29,7 @@ import { transition } from '../../utils/transition';
}) })
export class RouterOutlet implements ComponentInterface, NavOutlet { export class RouterOutlet implements ComponentInterface, NavOutlet {
private activeEl: HTMLElement | undefined; private activeEl: HTMLElement | undefined;
// TODO(FW-2832): types
private activeComponent: any; private activeComponent: any;
private activeParams: any; private activeParams: any;
private waitPromise?: Promise<void>; private waitPromise?: Promise<void>;

View File

@ -26,7 +26,7 @@ export class Segment implements ComponentInterface {
private checked?: HTMLIonSegmentButtonElement; private checked?: HTMLIonSegmentButtonElement;
// Value to be emitted when gesture ends // Value to be emitted when gesture ends
private valueAfterGesture?: any; private valueAfterGesture?: string;
@Element() el!: HTMLIonSegmentElement; @Element() el!: HTMLIonSegmentElement;

View File

@ -6,6 +6,8 @@ import type { SelectPopoverOption } from '../../interface';
import { safeCall } from '../../utils/overlays'; import { safeCall } from '../../utils/overlays';
import { getClassMap } from '../../utils/theme'; import { getClassMap } from '../../utils/theme';
// TODO(FW-2832): types
/** /**
* @internal * @internal
*/ */

View File

@ -22,6 +22,8 @@ import { watchForOptions } from '../../utils/watch-options';
import type { SelectCompareFn } from './select-interface'; import type { SelectCompareFn } from './select-interface';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* *

View File

@ -18,7 +18,7 @@ export interface SpinnerData {
y2?: number; y2?: number;
cx?: number; cx?: number;
cy?: number; cy?: number;
style: any; style: any; // TODO(FW-2832): type
viewBox?: string; viewBox?: string;
transform?: string; transform?: string;
} }

View File

@ -52,7 +52,7 @@ export class Spinner implements ComponentInterface {
const spinnerName = self.getName(); const spinnerName = self.getName();
const spinner = SPINNERS[spinnerName] ?? SPINNERS['lines']; const spinner = SPINNERS[spinnerName] ?? SPINNERS['lines'];
const duration = typeof self.duration === 'number' && self.duration > 10 ? self.duration : spinner.dur; const duration = typeof self.duration === 'number' && self.duration > 10 ? self.duration : spinner.dur;
const svgs: any[] = []; const svgs: any[] = []; // TODO(FW-2832): type
if (spinner.circles !== undefined) { if (spinner.circles !== undefined) {
for (let i = 0; i < spinner.circles; i++) { for (let i = 0; i < spinner.circles; i++) {

View File

@ -3,6 +3,8 @@ import { Build, Component, Element, Event, Host, Prop, State, Watch, h } from '@
import { getIonMode } from '../../global/ionic-global'; import { getIonMode } from '../../global/ionic-global';
// TODO(FW-2832): types
const SPLIT_PANE_MAIN = 'split-pane-main'; const SPLIT_PANE_MAIN = 'split-pane-main';
const SPLIT_PANE_SIDE = 'split-pane-side'; const SPLIT_PANE_SIDE = 'split-pane-side';
const QUERY: { [key: string]: string } = { const QUERY: { [key: string]: string } = {

View File

@ -22,6 +22,8 @@ import { mdEnterAnimation } from './animations/md.enter';
import { mdLeaveAnimation } from './animations/md.leave'; import { mdLeaveAnimation } from './animations/md.leave';
import type { ToastAttributes, ToastPosition } from './toast-interface'; import type { ToastAttributes, ToastPosition } from './toast-interface';
// TODO(FW-2832): types
/** /**
* @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use. * @virtualProp {"ios" | "md"} mode - The mode determines which platform styles to use.
* *
@ -40,7 +42,7 @@ import type { ToastAttributes, ToastPosition } from './toast-interface';
shadow: true, shadow: true,
}) })
export class Toast implements ComponentInterface, OverlayInterface { export class Toast implements ComponentInterface, OverlayInterface {
private durationTimeout: any; private durationTimeout?: ReturnType<typeof setTimeout>;
presented = false; presented = false;

View File

@ -60,7 +60,7 @@ export class Toolbar implements ComponentInterface {
const tagName = (ev.target as HTMLElement).tagName; const tagName = (ev.target as HTMLElement).tagName;
const updatedStyles = ev.detail; const updatedStyles = ev.detail;
const newStyles = {} as any; const newStyles = {} as CssClassMap;
const childStyles = this.childrenStyles.get(tagName) || {}; const childStyles = this.childrenStyles.get(tagName) || {};
let hasStyleChange = false; let hasStyleChange = false;

View File

@ -1,3 +1,5 @@
// TODO(FW-2832): types
export interface Cell { export interface Cell {
i: number; i: number;
index: number; index: number;

View File

@ -42,6 +42,8 @@ import {
updateVDom, updateVDom,
} from './virtual-scroll-utils'; } from './virtual-scroll-utils';
// TODO(FW-2832): types
@Component({ @Component({
tag: 'ion-virtual-scroll', tag: 'ion-virtual-scroll',
styleUrl: 'virtual-scroll.scss', styleUrl: 'virtual-scroll.scss',

View File

@ -1,5 +1,7 @@
import type { IonicConfig } from '../interface'; import type { IonicConfig } from '../interface';
// TODO(FW-2832): types
export class Config { export class Config {
private m = new Map<keyof IonicConfig, any>(); private m = new Map<keyof IonicConfig, any>();

View File

@ -5,6 +5,8 @@ import { isPlatform, setupPlatforms } from '../utils/platform';
import { config, configFromSession, configFromURL, saveConfig } from './config'; import { config, configFromSession, configFromURL, saveConfig } from './config';
// TODO(FW-2832): types
declare const Context: any; declare const Context: any;
let defaultMode: Mode; let defaultMode: Mode;

View File

@ -1,3 +1,5 @@
// TODO(FW-2832): types
export interface Animation { export interface Animation {
parentAnimation: Animation | undefined; parentAnimation: Animation | undefined;
elements: HTMLElement[]; elements: HTMLElement[];

View File

@ -38,8 +38,8 @@ const convertCamelCaseToHypen = (str: string) => {
export const getAnimationPrefix = (el: HTMLElement): string => { export const getAnimationPrefix = (el: HTMLElement): string => {
if (animationPrefix === undefined) { if (animationPrefix === undefined) {
const supportsUnprefixed = (el.style as any).animationName !== undefined; const supportsUnprefixed = el.style.animationName !== undefined;
const supportsWebkitPrefix = (el.style as any).webkitAnimationName !== undefined; const supportsWebkitPrefix = el.style.webkitAnimationName !== undefined;
animationPrefix = !supportsUnprefixed && supportsWebkitPrefix ? '-webkit-' : ''; animationPrefix = !supportsUnprefixed && supportsWebkitPrefix ? '-webkit-' : '';
} }
return animationPrefix; return animationPrefix;
@ -57,7 +57,7 @@ export const removeStyleProperty = (element: HTMLElement, propertyName: string)
export const animationEnd = (el: HTMLElement | null, callback: (ev?: TransitionEvent) => void) => { export const animationEnd = (el: HTMLElement | null, callback: (ev?: TransitionEvent) => void) => {
let unRegTrans: (() => void) | undefined; let unRegTrans: (() => void) | undefined;
const opts: any = { passive: true }; const opts: AddEventListenerOptions = { passive: true };
const unregister = () => { const unregister = () => {
if (unRegTrans) { if (unRegTrans) {
@ -85,6 +85,7 @@ export const animationEnd = (el: HTMLElement | null, callback: (ev?: TransitionE
return unregister; return unregister;
}; };
// TODO(FW-2832): type
export const generateKeyframeRules = (keyframes: any[] = []) => { export const generateKeyframeRules = (keyframes: any[] = []) => {
return keyframes return keyframes
.map((keyframe) => { .map((keyframe) => {
@ -115,6 +116,7 @@ export const generateKeyframeName = (keyframeRules: string) => {
export const getStyleContainer = (element: HTMLElement) => { export const getStyleContainer = (element: HTMLElement) => {
// getRootNode is not always available in SSR environments. // getRootNode is not always available in SSR environments.
// TODO(FW-2832): types
const rootNode = element.getRootNode !== undefined ? (element.getRootNode() as any) : element; const rootNode = element.getRootNode !== undefined ? (element.getRootNode() as any) : element;
return rootNode.head || rootNode; return rootNode.head || rootNode;
}; };

View File

@ -23,6 +23,8 @@ import {
setStyleProperty, setStyleProperty,
} from './animation-utils'; } from './animation-utils';
// TODO(FW-2832): types
interface AnimationOnFinishCallback { interface AnimationOnFinishCallback {
c: AnimationLifecycle; c: AnimationLifecycle;
o?: AnimationCallbackOptions; o?: AnimationCallbackOptions;

View File

@ -201,6 +201,7 @@ export interface IonicConfig {
hideCaretOnScroll?: boolean; hideCaretOnScroll?: boolean;
// INTERNAL configs // INTERNAL configs
// TODO(FW-2832): types
persistConfig?: boolean; persistConfig?: boolean;
_forceStatusbarPadding?: boolean; _forceStatusbarPadding?: boolean;
_testing?: boolean; _testing?: boolean;

View File

@ -62,6 +62,7 @@ export const findClosestIonContent = (el: Element) => {
* Scrolls to the top of the element. If an `ion-content` is found, it will scroll * Scrolls to the top of the element. If an `ion-content` is found, it will scroll
* using the public API `scrollToTop` with a duration. * using the public API `scrollToTop` with a duration.
*/ */
// TODO(FW-2832): type
export const scrollToTop = (el: HTMLElement, durationMs: number): Promise<any> => { export const scrollToTop = (el: HTMLElement, durationMs: number): Promise<any> => {
if (isIonContent(el)) { if (isIonContent(el)) {
const content = el as HTMLIonContentElement; const content = el as HTMLIonContentElement;

View File

@ -32,8 +32,8 @@ export const startFocusVisible = (rootEl?: HTMLElement) => {
setFocus([]); setFocus([]);
}; };
const onKeydown = (ev: any) => { const onKeydown = (ev: Event) => {
keyboardMode = FOCUS_KEYS.includes(ev.key); keyboardMode = FOCUS_KEYS.includes((ev as KeyboardEvent).key);
if (!keyboardMode) { if (!keyboardMode) {
setFocus([]); setFocus([]);
} }
@ -41,6 +41,7 @@ export const startFocusVisible = (rootEl?: HTMLElement) => {
const onFocusin = (ev: Event) => { const onFocusin = (ev: Event) => {
if (keyboardMode && ev.composedPath !== undefined) { if (keyboardMode && ev.composedPath !== undefined) {
const toFocus = ev.composedPath().filter((el: any) => { const toFocus = ev.composedPath().filter((el: any) => {
// TODO(FW-2832): type
if (el.classList) { if (el.classList) {
return el.classList.contains(ION_FOCUSABLE); return el.classList.contains(ION_FOCUSABLE);
} }

View File

@ -2,6 +2,8 @@ import type { ComponentRef, FrameworkDelegate } from '../interface';
import { componentOnReady } from './helpers'; import { componentOnReady } from './helpers';
// TODO(FW-2832): types
export const attachComponent = async ( export const attachComponent = async (
delegate: FrameworkDelegate | undefined, delegate: FrameworkDelegate | undefined,
container: Element, container: Element,

View File

@ -2,6 +2,8 @@ import { GESTURE_CONTROLLER } from './gesture-controller';
import { createPointerEvents } from './pointer-events'; import { createPointerEvents } from './pointer-events';
import { createPanRecognizer } from './recognizers'; import { createPanRecognizer } from './recognizers';
// TODO(FW-2832): types
export const createGesture = (config: GestureConfig): Gesture => { export const createGesture = (config: GestureConfig): Gesture => {
let hasCapturedPan = false; let hasCapturedPan = false;
let hasStartedPan = false; let hasStartedPan = false;

View File

@ -1,5 +1,5 @@
export const addEventListener = ( export const addEventListener = (
el: any, el: any, // TODO(FW-2832): type
eventName: string, eventName: string,
callback: EventListenerOrEventListenerObject, callback: EventListenerOrEventListenerObject,
opts: { opts: {

View File

@ -2,6 +2,7 @@ import { addEventListener } from './listener';
const MOUSE_WAIT = 2000; const MOUSE_WAIT = 2000;
// TODO(FW-2832): types
export const createPointerEvents = ( export const createPointerEvents = (
el: Node, el: Node,
pointerDown: any, pointerDown: any,

View File

@ -1,5 +1,6 @@
import type { BackButtonEvent } from '../interface'; import type { BackButtonEvent } from '../interface';
// TODO(FW-2832): type
type Handler = (processNextHandler: () => void) => Promise<any> | void | null; type Handler = (processNextHandler: () => void) => Promise<any> | void | null;
interface HandlerRegister { interface HandlerRegister {

View File

@ -2,6 +2,8 @@ import type { EventEmitter } from '@stencil/core';
import type { Side } from '../interface'; import type { Side } from '../interface';
// TODO(FW-2832): types
declare const __zone_symbol__requestAnimationFrame: any; declare const __zone_symbol__requestAnimationFrame: any;
declare const requestAnimationFrame: any; declare const requestAnimationFrame: any;

View File

@ -18,6 +18,7 @@ export const relocateInput = (
} }
}; };
// TODO(FW-2832): type
export const isFocused = (input: HTMLInputElement | HTMLTextAreaElement): boolean => { export const isFocused = (input: HTMLInputElement | HTMLTextAreaElement): boolean => {
return input === (input as any).getRootNode().activeElement; return input === (input as any).getRootNode().activeElement;
}; };

View File

@ -15,7 +15,7 @@ export const enableInputBlurring = () => {
focused = true; focused = true;
}; };
const onTouchend = (ev: any) => { const onTouchend = (ev: TouchEvent) => {
// if app did scroll return early // if app did scroll return early
if (didScroll) { if (didScroll) {
didScroll = false; didScroll = false;

View File

@ -12,7 +12,7 @@ export const enableScrollAssist = (
keyboardHeight: number, keyboardHeight: number,
disableClonedInput = false disableClonedInput = false
) => { ) => {
let coord: any; let coord: { x: number; y: number } | undefined;
const touchStart = (ev: Event) => { const touchStart = (ev: Event) => {
coord = pointerCoord(ev); coord = pointerCoord(ev);
}; };
@ -75,7 +75,7 @@ const jsSetFocus = async (
raf(() => componentEl.click()); raf(() => componentEl.click());
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
let scrollContentTimeout: any; let scrollContentTimeout: ReturnType<typeof setTimeout>;
const scrollContent = async () => { const scrollContent = async () => {
// clean up listeners and timeouts // clean up listeners and timeouts
if (scrollContentTimeout !== undefined) { if (scrollContentTimeout !== undefined) {

View File

@ -13,7 +13,7 @@ export const getScrollData = (componentEl: HTMLElement, contentEl: HTMLElement,
itemEl.getBoundingClientRect(), itemEl.getBoundingClientRect(),
contentEl.getBoundingClientRect(), contentEl.getBoundingClientRect(),
keyboardHeight, keyboardHeight,
(componentEl as any).ownerDocument.defaultView.innerHeight (componentEl as any).ownerDocument.defaultView.innerHeight // TODO(FW-2832): type
); );
}; };

View File

@ -5,6 +5,7 @@ const PADDING_TIMER_KEY = '$ionPaddingTimer';
export const enableScrollPadding = (keyboardHeight: number) => { export const enableScrollPadding = (keyboardHeight: number) => {
const doc = document; const doc = document;
// TODO(FW-2832): types
const onFocusin = (ev: any) => { const onFocusin = (ev: any) => {
setScrollPadding(ev.target, keyboardHeight); setScrollPadding(ev.target, keyboardHeight);
}; };

View File

@ -101,6 +101,8 @@ export const startInputShims = (config: Config, platform: 'ios' | 'android') =>
registerInput(input); registerInput(input);
} }
// TODO(FW-2832): types
doc.addEventListener('ionInputDidLoad', ((ev: InputEvent) => { doc.addEventListener('ionInputDidLoad', ((ev: InputEvent) => {
registerInput(ev.detail); registerInput(ev.detail);
}) as any); }) as any);

View File

@ -2,6 +2,8 @@ export const KEYBOARD_DID_OPEN = 'ionKeyboardDidShow';
export const KEYBOARD_DID_CLOSE = 'ionKeyboardDidHide'; export const KEYBOARD_DID_CLOSE = 'ionKeyboardDidHide';
const KEYBOARD_THRESHOLD = 150; const KEYBOARD_THRESHOLD = 150;
// TODO(FW-2832): types
let previousVisualViewport: any = {}; let previousVisualViewport: any = {};
let currentVisualViewport: any = {}; let currentVisualViewport: any = {};

View File

@ -166,7 +166,7 @@ const createMenuController = () => {
}; };
const _createAnimation = (type: string, menuCmp: MenuI) => { const _createAnimation = (type: string, menuCmp: MenuI) => {
const animationBuilder = menuAnimations.get(type) as any; const animationBuilder = menuAnimations.get(type) as any; // TODO(FW-2832): type
if (!animationBuilder) { if (!animationBuilder) {
throw new Error('animation not registered'); throw new Error('animation not registered');
} }
@ -209,6 +209,7 @@ const createMenuController = () => {
if (typeof document !== 'undefined') { if (typeof document !== 'undefined') {
document.addEventListener('ionBackButton', (ev: any) => { document.addEventListener('ionBackButton', (ev: any) => {
// TODO(FW-2832): type
const openMenu = _getOpenSync(); const openMenu = _getOpenSync();
if (openMenu) { if (openMenu) {
(ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => { (ev as BackButtonEvent).detail.register(MENU_BACK_BUTTON_PRIORITY, () => {

View File

@ -2,6 +2,8 @@ import { config } from '../global/config';
export type Platforms = keyof typeof PLATFORMS_MAP; export type Platforms = keyof typeof PLATFORMS_MAP;
// TODO(FW-2832): types
interface IsPlatformSignature { interface IsPlatformSignature {
(plt: Platforms): boolean; (plt: Platforms): boolean;
(win: Window, plt: Platforms): boolean; (win: Window, plt: Platforms): boolean;

View File

@ -82,6 +82,7 @@ export const sanitizeDOMString = (untrustedString: IonicSafeString | string | un
* and then recursively dig down into any child elements to * and then recursively dig down into any child elements to
* clean those up as well * clean those up as well
*/ */
// TODO(FW-2832): type (using Element triggers other type errors as well)
const sanitizeElement = (element: any) => { const sanitizeElement = (element: any) => {
// IE uses childNodes, so ignore nodes that are not elements // IE uses childNodes, so ignore nodes that are not elements
if (element.nodeType && element.nodeType !== 1) { if (element.nodeType && element.nodeType !== 1) {
@ -123,6 +124,7 @@ const sanitizeElement = (element: any) => {
* IE doesn't always support .children * IE doesn't always support .children
* so we revert to .childNodes instead * so we revert to .childNodes instead
*/ */
// TODO(FW-2832): type
const getElementChildren = (el: any) => { const getElementChildren = (el: any) => {
return el.children != null ? el.children : el.childNodes; return el.children != null ? el.children : el.childNodes;
}; };

View File

@ -7,7 +7,7 @@ export const startTapClick = (config: Config) => {
let activatableEle: HTMLElement | undefined; let activatableEle: HTMLElement | undefined;
let activeRipple: Promise<() => void> | undefined; let activeRipple: Promise<() => void> | undefined;
let activeDefer: any; let activeDefer: ReturnType<typeof setTimeout> | undefined;
const useRippleEffect = config.getBoolean('animated', true) && config.getBoolean('rippleEffect', true); const useRippleEffect = config.getBoolean('animated', true) && config.getBoolean('rippleEffect', true);
const clearDefers = new WeakMap<HTMLElement, any>(); const clearDefers = new WeakMap<HTMLElement, any>();
@ -43,7 +43,7 @@ export const startTapClick = (config: Config) => {
}; };
const cancelActive = () => { const cancelActive = () => {
clearTimeout(activeDefer); if (activeDefer) clearTimeout(activeDefer);
activeDefer = undefined; activeDefer = undefined;
if (activatableEle) { if (activatableEle) {
removeActivated(false); removeActivated(false);
@ -67,7 +67,7 @@ export const startTapClick = (config: Config) => {
if (el && el === activatableEle) { if (el && el === activatableEle) {
return; return;
} }
clearTimeout(activeDefer); if (activeDefer) clearTimeout(activeDefer);
activeDefer = undefined; activeDefer = undefined;
const { x, y } = pointerCoord(ev); const { x, y } = pointerCoord(ev);
@ -163,6 +163,7 @@ export const startTapClick = (config: Config) => {
doc.addEventListener('mouseup', onMouseUp, true); doc.addEventListener('mouseup', onMouseUp, true);
}; };
// TODO(FW-2832): type
const getActivatableTarget = (ev: UIEvent): any => { const getActivatableTarget = (ev: UIEvent): any => {
if (ev.composedPath !== undefined) { if (ev.composedPath !== undefined) {
/** /**

View File

@ -12,6 +12,8 @@ import { componentOnReady, raf } from '../helpers';
const iosTransitionAnimation = () => import('./ios.transition'); const iosTransitionAnimation = () => import('./ios.transition');
const mdTransitionAnimation = () => import('./md.transition'); const mdTransitionAnimation = () => import('./md.transition');
// TODO(FW-2832): types
export const transition = (opts: TransitionOptions): Promise<TransitionResult> => { export const transition = (opts: TransitionOptions): Promise<TransitionResult> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
writeTask(() => { writeTask(() => {

View File

@ -5,6 +5,8 @@ import { getIonPageElement } from '../transition';
const DURATION = 540; const DURATION = 540;
// TODO(FW-2832): types
const getClonedElement = (tagName: string): any => { const getClonedElement = (tagName: string): any => {
return document.querySelector(`${tagName}.ion-cloned-element`) as any; return document.querySelector(`${tagName}.ion-cloned-element`) as any;
}; };

View File

@ -1,3 +1,5 @@
// TODO(FW-2832): types
export const watchForOptions = <T extends HTMLElement>( export const watchForOptions = <T extends HTMLElement>(
containerEl: HTMLElement, containerEl: HTMLElement,
tagName: string, tagName: string,

View File

@ -12,6 +12,8 @@ import { matchPath } from 'react-router-dom';
import { clonePageElement } from './clonePageElement'; import { clonePageElement } from './clonePageElement';
// TODO(FW-2959): types
interface StackManagerProps { interface StackManagerProps {
routeInfo: RouteInfo; routeInfo: RouteInfo;
} }

View File

@ -9,6 +9,8 @@ import {
} from '@ionic/core/components'; } from '@ionic/core/components';
import React, { PropsWithChildren } from 'react'; import React, { PropsWithChildren } from 'react';
// TODO(FW-2959): types
interface PartialPropertyValue { interface PartialPropertyValue {
property: string; property: string;
value: any; value: any;

View File

@ -21,6 +21,7 @@ export interface ActionSheetOptions extends Omit<ActionSheetOptionsCore, 'button
} }
const actionSheetController = { const actionSheetController = {
// TODO(FW-2959): type
create: (options: ActionSheetOptions) => actionSheetControllerCore.create(options as any), create: (options: ActionSheetOptions) => actionSheetControllerCore.create(options as any),
dismiss: (data?: any, role?: string | undefined, id?: string | undefined) => dismiss: (data?: any, role?: string | undefined, id?: string | undefined) =>
actionSheetControllerCore.dismiss(data, role, id), actionSheetControllerCore.dismiss(data, role, id),

View File

@ -15,7 +15,7 @@ type Props = LocalJSX.IonApp &
export const IonApp = /*@__PURE__*/ (() => export const IonApp = /*@__PURE__*/ (() =>
class extends React.Component<Props> { class extends React.Component<Props> {
addOverlayCallback?: (id: string, overlay: any, containerElement: HTMLDivElement) => void; addOverlayCallback?: (id: string, overlay: ReactComponentOrElement, containerElement: HTMLDivElement) => void;
removeOverlayCallback?: (id: string) => void; removeOverlayCallback?: (id: string) => void;
constructor(props: Props) { constructor(props: Props) {

View File

@ -27,7 +27,7 @@ export const IonOverlayManager: React.FC<IonOverlayManagerProps> = ({
}) => { }) => {
type OverlaysList = { type OverlaysList = {
[key: string]: { [key: string]: {
component: any; component: any; // TODO(FW-2959): type
containerElement: HTMLDivElement; containerElement: HTMLDivElement;
}; };
}; };

View File

@ -6,7 +6,7 @@ export interface IonRouteProps {
path?: string; path?: string;
exact?: boolean; exact?: boolean;
show?: boolean; show?: boolean;
render: (props?: any) => JSX.Element; render: (props?: any) => JSX.Element; // TODO(FW-2959): type
disableIonPageManagement?: boolean; disableIonPageManagement?: boolean;
} }

View File

@ -19,7 +19,7 @@ export interface IonRouterContextState {
} }
export const IonRouterContext = React.createContext<IonRouterContextState>({ export const IonRouterContext = React.createContext<IonRouterContextState>({
routeInfo: undefined as any, routeInfo: undefined as any, // TODO(FW-2959): type
push: () => { push: () => {
throw new Error('An Ionic Router is required for IonRouterContext'); throw new Error('An Ionic Router is required for IonRouterContext');
}, },

View File

@ -10,6 +10,8 @@ import {
} from './react-component-lib/utils'; } from './react-component-lib/utils';
import { createForwardRef } from './utils'; import { createForwardRef } from './utils';
// TODO(FW-2959): types
type InlineOverlayState = { type InlineOverlayState = {
isOpen: boolean; isOpen: boolean;
}; };

View File

@ -15,6 +15,8 @@ import {
} from './react-component-lib/utils'; } from './react-component-lib/utils';
import { createForwardRef } from './utils'; import { createForwardRef } from './utils';
// TODO(FW-2959): types
interface IonicReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> { interface IonicReactInternalProps<ElementType> extends React.HTMLAttributes<ElementType> {
forwardedRef?: React.ForwardedRef<ElementType>; forwardedRef?: React.ForwardedRef<ElementType>;
href?: string; href?: string;

View File

@ -35,6 +35,8 @@ interface IonTabBarState {
tabs: { [key: string]: TabUrls }; tabs: { [key: string]: TabUrls };
} }
// TODO(FW-2959): types
class IonTabBarUnwrapped extends React.PureComponent<InternalProps, IonTabBarState> { class IonTabBarUnwrapped extends React.PureComponent<InternalProps, IonTabBarState> {
context!: React.ContextType<typeof NavContext>; context!: React.ContextType<typeof NavContext>;

View File

@ -9,7 +9,7 @@ type Props = LocalJSX.IonTabButton &
IonicReactProps & { IonicReactProps & {
routerOptions?: RouterOptions; routerOptions?: RouterOptions;
ref?: React.Ref<HTMLIonTabButtonElement>; ref?: React.Ref<HTMLIonTabButtonElement>;
onClick?: (e: any) => void; onClick?: (e: Event) => void;
}; };
export const IonTabButton = /*@__PURE__*/ (() => export const IonTabButton = /*@__PURE__*/ (() =>

View File

@ -15,6 +15,8 @@ class IonTabsElement extends HTMLElementSSR {
} }
} }
// TODO(FW-2959): types
if (typeof (window as any) !== 'undefined' && window.customElements) { if (typeof (window as any) !== 'undefined' && window.customElements) {
const element = window.customElements.get('ion-tabs'); const element = window.customElements.get('ion-tabs');
if (!element) { if (!element) {

View File

@ -13,7 +13,7 @@ export type IonicReactExternalProps<PropType, ElementType> = PropType &
IonicReactProps; IonicReactProps;
export const createForwardRef = <PropType, ElementType>( export const createForwardRef = <PropType, ElementType>(
ReactComponent: any, ReactComponent: any, // TODO(FW-2959): type
displayName: string displayName: string
) => { ) => {
const forwardRef = ( const forwardRef = (

Some files were not shown because too many files have changed in this diff Show More