diff --git a/packages/action-menu/test/action-menu.test.ts b/packages/action-menu/test/action-menu.test.ts index ccea3c8cbd..fbe977183f 100644 --- a/packages/action-menu/test/action-menu.test.ts +++ b/packages/action-menu/test/action-menu.test.ts @@ -16,7 +16,6 @@ import '../../menu/lib/index.js'; import '../../menu-item/lib/index.js'; import { fixture, elementUpdated, html, expect } from '@open-wc/testing'; import { waitForPredicate } from '../../../test/testing-helpers'; -import { FocusVisiblePolyfillableElement } from '../../shared/lib/focus-visible.js'; describe('Action menu', () => { it('loads', async () => { @@ -48,11 +47,7 @@ describe('Action menu', () => { ` ); - await waitForPredicate( - () => - !!((window as unknown) as FocusVisiblePolyfillableElement) - .applyFocusVisiblePolyfill - ); + await waitForPredicate(() => !!window.applyFocusVisiblePolyfill); await elementUpdated(el); expect(el).to.not.be.undefined; @@ -88,11 +83,7 @@ describe('Action menu', () => { ` ); - await waitForPredicate( - () => - !!((window as unknown) as FocusVisiblePolyfillableElement) - .applyFocusVisiblePolyfill - ); + await waitForPredicate(() => !!window.applyFocusVisiblePolyfill); await elementUpdated(el); expect(el).to.not.be.undefined; diff --git a/packages/shared/src/focus-visible.ts b/packages/shared/src/focus-visible.ts index fd27b3de80..caf13e1924 100644 --- a/packages/shared/src/focus-visible.ts +++ b/packages/shared/src/focus-visible.ts @@ -10,18 +10,24 @@ OF ANY KIND, either express or implied. See the License for the specific languag governing permissions and limitations under the License. */ +declare global { + interface Window { + applyFocusVisiblePolyfill?: (scope: Document | ShadowRoot) => void; + } +} + type Constructor = { // eslint-disable-next-line @typescript-eslint/no-explicit-any new (...args: any[]): T; prototype: T; }; -export interface OptionalLifecycleCallbacks { +interface OptionalLifecycleCallbacks { connectedCallback?(): void; disconnectedCallback?(): void; } -export type MixableBaseClass = HTMLElement & OptionalLifecycleCallbacks; +type MixableBaseClass = HTMLElement & OptionalLifecycleCallbacks; type EndPolyfillCoordinationCallback = () => void; diff --git a/packages/shared/src/missing-types.d.ts b/packages/shared/src/missing-types.d.ts index f606fe50e1..6384c6d260 100644 --- a/packages/shared/src/missing-types.d.ts +++ b/packages/shared/src/missing-types.d.ts @@ -1,7 +1 @@ -declare module 'focus-visible' { - declare global { - interface Window { - applyFocusVisiblePolyfill?: (scope: Document | ShadowRoot) => void; - } - } -} +declare module 'focus-visible';