Declaration files
Declaration files are used to provide type checking for certain globals and other types that you know will be defined in your codebase and you want to be globally available.
Adding to prototype
In a .d.ts file, you can add global declarations of the prototype that will then have type intellisense.
interface HTMLElement {
on(
event: string,
handler: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions
): void;
off(
event: string,
handler: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions
): void;
$(selector: string): Element | null;
$$(selector: string): NodeListOf<Element>;
}