forked from speced/respec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype-helper.d.ts
114 lines (102 loc) · 2.53 KB
/
type-helper.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
interface Element {
/*
* This signature helps JSDoc to assert types in a separate line:
* / @type {HTMLElement} /
* const parent = child.closest(selector);
*
* Rather than:
* const parent = / @type {HTMLElement} / (child.closest(selector));
*/
closest<T extends Element>(selector: string): T | null;
}
declare module "text!*" {
const value: string;
export default value;
}
declare var respecConfig: any;
interface Window {
respecVersion: string;
respecUI: {
show(): void;
hide(): void;
enable(): void;
addCommand(
label: string,
handler: () => void,
keyShort?: string,
icon?: string
): any;
error(msg: string): void;
warning(msg: string): void;
closeModal(owner?: Element): void;
freshModal(title: string, content: string, currentOwner: Element): void;
};
require?: {
(deps: string[], callback: (...modules: any[]) => void): void;
modules: { [dep: string]: any };
};
$: JQueryStatic;
jQuery: JQueryStatic;
}
interface Document {
respecIsReady: Promise<void>;
createNodeIterator<T>(
root: Node,
whatToShow?: number,
filter?: (node: T) => number | null
): NodeIterator<T>;
createTreeWalker<T>(
root: Node,
whatToShow?: number,
filter?: (node: T) => boolean | null
): TreeWalker<T>;
}
interface NodeIterator<T extends Node> {}
interface TreeWalker<T extends Node> {}
interface Node {
cloneNode<T extends Node = this>(deep?: boolean): T;
}
declare function fetch(input: URL, init?: RequestInit): Promise<Response>;
declare namespace Intl {
class ListFormat {
constructor(
locales?: string | string[],
options?: {
localeMatcher?: "lookup" | "best fit";
style: "long" | "narrow";
type: "conjunction" | "disjunction" | "unit";
}
);
format(items: Iterable<string>): string;
}
}
interface JQuery {
renameElement(name: string): JQuery<any>;
getDfnTitles(): string[];
linkTargets(): import("./core/utils.js").LinkTarget[];
makeID(pfx?: string, txt?: string, noLC?: boolean): string;
allTextNodes(exclusions: string[]): Text[];
}
module "core/xref" {
export interface RequestEntry {
term: string;
id: string;
types: string[];
specs?: string[][];
for?: string;
}
export interface SearchResultEntry {
uri: string;
shortname: string;
spec: string;
type: string;
normative: boolean;
for?: string[];
}
export interface Response {
result: {
[id: string]: SearchResultEntry[];
};
query?: RequestEntry[];
}
}