Created
October 2, 2018 16:07
-
-
Save inakianduaga/91b9cbb27e6079dca749dbd54d855c6d to your computer and use it in GitHub Desktop.
Typesafe CustomEvents on your Frontend - CustomEvent global augmentation example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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