fix(extension typings): remove some accessibility modifiers from Component (#3437)

This commit is contained in:
David Wheatley 2022-06-20 03:52:25 +01:00 committed by GitHub
parent cb47a9c92e
commit 9fc2e5e2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -33,14 +33,14 @@ export default abstract class Component<Attrs extends ComponentAttrs = Component
/** /**
* The root DOM element for the component. * The root DOM element for the component.
*/ */
protected element!: Element; element!: Element;
/** /**
* The attributes passed into the component. * The attributes passed into the component.
* *
* @see https://mithril.js.org/components.html#passing-data-to-components * @see https://mithril.js.org/components.html#passing-data-to-components
*/ */
protected attrs!: Attrs; attrs!: Attrs;
/** /**
* Class component state that is persisted between redraws. * Class component state that is persisted between redraws.
@ -53,7 +53,7 @@ export default abstract class Component<Attrs extends ComponentAttrs = Component
* *
* This is `undefined` by default. * This is `undefined` by default.
*/ */
protected state!: State; state!: State;
/** /**
* @inheritdoc * @inheritdoc
@ -109,7 +109,7 @@ export default abstract class Component<Attrs extends ComponentAttrs = Component
* @returns the jQuery object for the DOM node * @returns the jQuery object for the DOM node
* @final * @final
*/ */
protected $(selector?: string): JQuery { $(selector?: string): JQuery {
const $element = $(this.element) as JQuery<HTMLElement>; const $element = $(this.element) as JQuery<HTMLElement>;
return selector ? $element.find(selector) : $element; return selector ? $element.find(selector) : $element;
@ -156,5 +156,5 @@ export default abstract class Component<Attrs extends ComponentAttrs = Component
* *
* This can be used to assign default values for missing, optional attrs. * This can be used to assign default values for missing, optional attrs.
*/ */
protected static initAttrs<T>(attrs: T): void {} static initAttrs<T>(attrs: T): void {}
} }

View File

@ -71,11 +71,11 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
*/ */
// TODO: [Flarum 2.0] Remove this. // TODO: [Flarum 2.0] Remove this.
// @ts-expect-error This is a get accessor, while superclass defines this as a property. This is needed to prevent breaking changes, however. // @ts-expect-error This is a get accessor, while superclass defines this as a property. This is needed to prevent breaking changes, however.
protected get state() { get state() {
fireDeprecationWarning('`state` property of the Search component is deprecated', '3212'); fireDeprecationWarning('`state` property of the Search component is deprecated', '3212');
return this.searchState; return this.searchState;
} }
protected set state(state: SearchState) { set state(state: SearchState) {
// Workaround to prevent triggering deprecation warnings due to Mithril // Workaround to prevent triggering deprecation warnings due to Mithril
// setting state to undefined when creating components // setting state to undefined when creating components
state !== undefined && fireDeprecationWarning('`state` property of the Search component is deprecated', '3212'); state !== undefined && fireDeprecationWarning('`state` property of the Search component is deprecated', '3212');
@ -107,7 +107,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
protected navigator!: KeyboardNavigatable; protected navigator!: KeyboardNavigatable;
protected searchTimeout?: NodeJS.Timeout; protected searchTimeout?: number;
private updateMaxHeightHandler?: () => void; private updateMaxHeightHandler?: () => void;
@ -240,7 +240,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
if (!query) return; if (!query) return;
if (search.searchTimeout) clearTimeout(search.searchTimeout); if (search.searchTimeout) clearTimeout(search.searchTimeout);
search.searchTimeout = setTimeout(() => { search.searchTimeout = window.setTimeout(() => {
if (state.isCached(query)) return; if (state.isCached(query)) return;
if (query.length >= (search.constructor as typeof Search).MIN_SEARCH_LEN) { if (query.length >= (search.constructor as typeof Search).MIN_SEARCH_LEN) {