How to supplement your Typescript type definitions

A collection of different typescript definitions to supplement non-typescript libraries.

Extending existing library definitions

To extend a class definition of an npm module you can use the following syntax in your .d.ts file

declare module '@ionic/angular' {
export interface Slides {
update(): void;
slideTo(index: number, delay: number): void;
}
}

Declaring Variables in the global scope or on window

declare global {
interface Window {
VAR_NAME: any;
}
let ga: (...args) => {};
}