-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathhtml-parse-stringify.d.ts
More file actions
43 lines (36 loc) · 1.03 KB
/
Copy pathhtml-parse-stringify.d.ts
File metadata and controls
43 lines (36 loc) · 1.03 KB
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
declare module 'html-parse-stringify' {
namespace HTML {
interface TagNode {
type: 'tag';
name: string;
voidElement: boolean;
attrs: Record<string, string | undefined>;
children: Node[];
}
interface TextNode {
type: 'text';
content: string;
}
interface CommentNode {
type: 'comment';
comment: string;
}
interface ComponentNode {
type: 'component';
name: string;
attrs: Record<string, string | undefined>;
voidElement: boolean;
children: [];
}
type Node = TagNode | TextNode | CommentNode | ComponentNode;
interface ParseOptions {
components?: Record<string, boolean>;
}
function parse(html: string, options?: ParseOptions): Node[];
function stringify(doc: Node[]): string;
}
// the CommonJS build assigns `module.exports = { parse, stringify }` with
// no `default` property, so `export =` is the only declaration shape that
// is correct both with and without esModuleInterop
export = HTML;
}