1
0
mirror of https://github.com/algora-io/tv.git synced 2024-12-06 01:03:34 +02:00
algora-tv/assets/js/global.d.ts
Zafer Cesur 446efb3c62
add typescript (#5)
* use typescript

* fix typing issues

* update tailwind config

* upgrade deps

* update comment
2024-03-10 19:24:20 +03:00

26 lines
643 B
TypeScript

import { type Channel } from "phoenix";
import { type LiveSocket } from "phoenix_live_view";
interface PhxEvent extends Event {
target: Element;
detail: Record<string, any>;
}
type PhxEventKey = `js:${string}` | `phx:${string}`;
declare global {
interface Window {
liveSocket: LiveSocket;
userToken?: string;
channel?: Channel;
addEventListener<K extends keyof WindowEventMap | PhxEventKey>(
type: K,
listener: (
this: Window,
ev: K extends keyof WindowEventMap ? WindowEventMap[K] : PhxEvent
) => any,
options?: boolean | AddEventListenerOptions | undefined
): void;
}
}