Skip to content

Instantly share code, notes, and snippets.

@inakianduaga
Created October 2, 2018 16:07
Show Gist options
  • Save inakianduaga/91b9cbb27e6079dca749dbd54d855c6d to your computer and use it in GitHub Desktop.
Save inakianduaga/91b9cbb27e6079dca749dbd54d855c6d to your computer and use it in GitHub Desktop.
Typesafe CustomEvents on your Frontend - CustomEvent global augmentation example
export const ClassifiedListFilterUpdate = "CL_FILTER_UPDATE";
export type ClassifiedListFilterUpdate = {
searchUrls: {
/**
* Search url with legacy parameters
*/
legacy: string;
/**
* Search url with newer `mmm` parameters
*/
standard: string;
};
};
// inform compiler of the as24 custom events
declare global {
interface DocumentEventMap {
[ClassifiedListFilterUpdate]: CustomEvent<ClassifiedListFilterUpdate>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment