/* eslint-disable @typescript-eslint/consistent-type-definitions -- Declaration merging necessary */ /* eslint-disable @typescript-eslint/ban-types -- The API does return `null`, not `undefined` */ import type {StrictlyParseSelector} from 'typed-query-selector/parser'; declare global { interface ParentNode { querySelector(selector: S | readonly S[]): StrictlyParseSelector | null; querySelectorAll( selector: S | readonly S[], ): NodeListOf>; } interface Element { closest(selector: S | readonly S[]): StrictlyParseSelector | null; matches(selectors: string | readonly string[]): boolean; } // This cannot be a regular import because it turns `globals.d.ts` in a "module definition", which it isn't type Browser = import('webextension-polyfill').Browser; const browser: Browser; }