diff --git a/types/index.d.ts b/types/index.d.ts index 6f102c9..b0e1d08 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -4,18 +4,20 @@ export = TreeModel; -declare class TreeModel { - constructor(config?: TreeModel.Config); +declare class TreeModel { + constructor(config?: Config); - private config: TreeModel.Config; + private config: Config; - parse(model: TreeModel.Model): TreeModel.Node; + parse(model: T): TreeModel.Node; } declare namespace TreeModel { class Node { - constructor(config: any, model: Model); - + constructor(config: any, model: T); + model: T; + children: Node[]; + parent: Node | undefined; isRoot(): boolean; hasChildren(): boolean; addChild(child: Node): Node; @@ -44,7 +46,6 @@ declare namespace TreeModel { */ childrenPropertyName?: string; modelComparatorFn?: ComparatorFunction; - [propName: string]: any; } interface Options { @@ -55,6 +56,4 @@ declare namespace TreeModel { type ComparatorFunction = (left: any, right: any) => boolean; type NodeVisitorFunction = (visitingNode: Node) => boolean; - - type Model = T & { children?: Array> }; }