|
1 | | -import type { knownPages, loadPrefix, navigatePrefix } from '../scripts/page/dispatcher'; |
| 1 | +import type { knownPages } from '../scripts/helpers/shared'; |
| 2 | +import type { loadPrefix, navigatePrefix } from '../scripts/page/dispatcher'; |
2 | 3 |
|
3 | 4 | type prefixes = typeof navigatePrefix | typeof loadPrefix; |
4 | 5 |
|
5 | 6 | declare global { |
6 | 7 | type FnArgs<F> = F extends (this: any, ...args: infer R) => any ? R : never; |
7 | 8 | type CtrArgs<F> = F extends new (...args: infer R) => any ? R : never; |
8 | 9 |
|
9 | | - type NavigateOrLoadEvent<K extends string, D extends { [key: string]: any } = { [key: string]: any }> = CustomEvent<{ page: K, from: string } & D>; |
10 | | - type PageEvent<K extends string> = NavigateOrLoadEvent<K, { more: string | undefined }>; |
11 | | - type VideoEvent = NavigateOrLoadEvent<'video', { video: string }>; |
| 10 | + type NavigateOrLoadEvent<K extends string, D extends { [key: string]: any; } = { [key: string]: any; }> = CustomEvent<{ page: K, from: string; } & D>; |
| 11 | + type PageEvent<K extends string> = NavigateOrLoadEvent<K, { more: string | undefined; }>; |
| 12 | + type VideoEvent = NavigateOrLoadEvent<'video', { video: string; }>; |
12 | 13 | type HomeEvent = NavigateOrLoadEvent<'home'>; |
13 | | - type CreatorEvent = NavigateOrLoadEvent<'creator', { who: string, more: string | undefined }>; |
| 14 | + type CreatorEvent = NavigateOrLoadEvent<'creator', { who: string, more: string | undefined; }>; |
14 | 15 | interface Document { |
15 | 16 | addEventListener<K extends typeof knownPages[number], P extends prefixes>(type: `${P}-${K}`, listener: (this: Document, ev: PageEvent<K>) => any, options?: boolean | AddEventListenerOptions): void; |
16 | 17 | addEventListener<P extends prefixes>(type: `${P}-video`, listener: (this: Document, ev: VideoEvent) => any, options?: boolean | AddEventListenerOptions): void; |
|
0 commit comments