-
Notifications
You must be signed in to change notification settings - Fork 82
/
types.d.ts
40 lines (33 loc) · 1.36 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
declare const wasmFeatureDetect: typeof import('wasm-feature-detect');
declare const tippy: typeof import('tippy.js').default;
interface ParentNode {
querySelector<K extends keyof HTMLElementTagNameMap>(tag: K): HTMLElementTagNameMap[K] | null;
querySelector(selectors: string): HTMLElement | null;
querySelectorAll<K extends keyof HTMLElementTagNameMap>(tag: K): NodeListOf<HTMLElementTagNameMap[K]>;
querySelectorAll(selectors: string): NodeListOf<HTMLElement>;
}
interface Object {
/**
* Prefer the `key in obj` syntax over this helper if the object is 1)
* definitely an object and 2) is a simple object (aka null prototype)
*/
hasOwnProperty<K extends PropertyKey>(key: K): this is Record<K, unknown>;
hasTitle(): this is string | Record<'title', string>;
}
interface String {
get title(): string;
}
// TODO: Automate this
interface YnoElements {
scheduleTemplate: 'template'
}
interface Document {
getElementById<K extends keyof YnoElements>(id: K): HTMLElementTagNameMap[YnoElements[K]];
}
declare class FastdomPromised {
clear<T extends Promise<any>>(task: T): void;
initialize(): void;
measure<T extends () => void>(task: T, context?: any): Promise<Awaited<ReturnType<T>>>;
mutate<T extends () => void>(task: T, context?: any): Promise<Awaited<ReturnType<T>>>;
}
declare const fastdom: FastdomPromised;