From 9ce632318eb3f63180a419de7523dcec5e21a695 Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 17:46:31 -0700 Subject: [PATCH 1/7] Update index.d.ts Fix access to model within TreeNode vistors. --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 6f102c9..17666d5 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -14,7 +14,7 @@ declare class TreeModel { declare namespace TreeModel { class Node { - constructor(config: any, model: Model); + constructor(config: any, public model: Model) {} isRoot(): boolean; hasChildren(): boolean; From fa178198c5708cad773b165bb602266dcd030b7a Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 17:48:26 -0700 Subject: [PATCH 2/7] Update index.d.ts --- types/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 17666d5..60813a6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -14,8 +14,8 @@ declare class TreeModel { declare namespace TreeModel { class Node { - constructor(config: any, public model: Model) {} - + constructor(config: any, model: Model); + model: Model; isRoot(): boolean; hasChildren(): boolean; addChild(child: Node): Node; From 8ccfd92037e31f5ffe722adb26bd88bb8053b55a Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 19:11:14 -0700 Subject: [PATCH 3/7] Update index.d.ts --- types/index.d.ts | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 60813a6..7e40627 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -4,18 +4,18 @@ 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 & {[Key in Config['childrenPropertyName'] extends string ? Config['childrenPropertyName'] : 'children']: T[] }): TreeModel.Node; } declare namespace TreeModel { class Node { - constructor(config: any, model: Model); - model: Model; + constructor(config: any, model: T); + model: T; isRoot(): boolean; hasChildren(): boolean; addChild(child: Node): Node; @@ -44,7 +44,6 @@ declare namespace TreeModel { */ childrenPropertyName?: string; modelComparatorFn?: ComparatorFunction; - [propName: string]: any; } interface Options { @@ -55,6 +54,4 @@ declare namespace TreeModel { type ComparatorFunction = (left: any, right: any) => boolean; type NodeVisitorFunction = (visitingNode: Node) => boolean; - - type Model = T & { children?: Array> }; } From 0241d5c0b3eb91ad4c7c723b1f2e80977372dbc6 Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 19:12:10 -0700 Subject: [PATCH 4/7] Update index.d.ts --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 7e40627..e6e38a6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -4,7 +4,7 @@ export = TreeModel; -declare class TreeModel { +declare class TreeModel { constructor(config?: Config); private config: Config; From 80f853c524337d64a6569bbdaedd28ae9a25b3c3 Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 19:19:31 -0700 Subject: [PATCH 5/7] Update index.d.ts --- types/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index e6e38a6..55035dc 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -9,13 +9,14 @@ declare class TreeModel { private config: Config; - parse(model: T & {[Key in Config['childrenPropertyName'] extends string ? Config['childrenPropertyName'] : 'children']: T[] }): TreeModel.Node; + parse(model: T): TreeModel.Node; } declare namespace TreeModel { class Node { constructor(config: any, model: T); model: T; + children: Node[]; isRoot(): boolean; hasChildren(): boolean; addChild(child: Node): Node; From 74940dd286030eefde9e874091de5f0db23e30ab Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 19:27:39 -0700 Subject: [PATCH 6/7] Update index.d.ts --- types/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/index.d.ts b/types/index.d.ts index 55035dc..19928a5 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -17,6 +17,7 @@ declare namespace TreeModel { constructor(config: any, model: T); model: T; children: Node[]; + parent: Node; isRoot(): boolean; hasChildren(): boolean; addChild(child: Node): Node; From 6d3c9dcee83277978f46157d638f32a87950442c Mon Sep 17 00:00:00 2001 From: Aaron Reisman Date: Tue, 12 Apr 2022 19:28:50 -0700 Subject: [PATCH 7/7] Update index.d.ts --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 19928a5..b0e1d08 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -17,7 +17,7 @@ declare namespace TreeModel { constructor(config: any, model: T); model: T; children: Node[]; - parent: Node; + parent: Node | undefined; isRoot(): boolean; hasChildren(): boolean; addChild(child: Node): Node;