diff --git a/html-parse-stringify.d.ts b/html-parse-stringify.d.ts
index f3a6e9d..d76ccff 100644
--- a/html-parse-stringify.d.ts
+++ b/html-parse-stringify.d.ts
@@ -1,27 +1,35 @@
-declare var htmlParseStringify: htmlParseStringify.htmlParseStringify
+declare module 'html-parse-stringify' {
+ export interface TagNode {
+ type: 'tag';
+ name: string;
+ voidElement: boolean;
+ attrs: Record;
+ children: Node[];
+ }
-declare module htmlParseStringify {
- export interface htmlParseStringify {
- new (): htmlParseStringify
- parse_tag(tag: string): IDoc
- parse(html: string, options: IOptions): Array
- stringify(doc: IDoc): string
+ export interface TextNode {
+ type: 'text';
+ content: string;
}
- export interface IDoc {
- type: string
- content?: string
- voidElement: boolean
- name: string
- attrs: {}
- children: IDoc[]
+ export interface ComponentNode {
+ type: 'component';
+ name: string;
+ attrs: Record;
+ voidElement: boolean;
+ children: [];
}
- export interface IOptions {
- components: string[]
+ export type Node = TagNode | TextNode | ComponentNode;
+
+ export interface ParseOptions {
+ components: Record;
}
-}
-declare module 'html-parse-stringify' {
- export = htmlParseStringify
+ namespace HtmlParseStringify {
+ function parse(html: string, options?: ParseOptions): Node[];
+ function stringify(doc: Node[]): string;
+ }
+
+ export default HtmlParseStringify;
}