When merging global interfaces in TypeScript, you have to declare the interface in the global
scope.
export declare global {
interface Window {
// add you custom properties and methods
YT:(videoID: string, options?: {}) => Observable<YtResponse>
}
}
TypeScript supports declaration merging, the premise is the same for global objects. The difference is to declare the interface as part of the global scope.
Top comments (3)
No need to export
global
. It's called "global
" for a reasonIt works great! Thank you
This is super cool. Thank you for sharing.