Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch tree-model@1.0.7 for the project I'm working on.
- Allow usage of
node.all() which currently throws a typing error as it always expects at least 1 option
- Type
node.children so when iterating you do not get a typing error
Here is the diff that solved my problem:
diff --git a/node_modules/tree-model/types/index.d.ts b/node_modules/tree-model/types/index.d.ts
index 6f102c9..6ef264f 100644
--- a/node_modules/tree-model/types/index.d.ts
+++ b/node_modules/tree-model/types/index.d.ts
@@ -27,7 +27,7 @@ declare namespace TreeModel {
walk(options: Options, fn: NodeVisitorFunction<T>, ctx?: object): void;
walk(fn: NodeVisitorFunction<T>, ctx?: object): void;
- all(options: Options, fn: NodeVisitorFunction<T>, ctx?: object): Array<Node<T>>;
+ all(options?: Options, fn?: NodeVisitorFunction<T>, ctx?: object): Array<Node<T>>;
all(fn: NodeVisitorFunction<T>, ctx?: object): Array<Node<T>>;
first(options: Options, fn: NodeVisitorFunction<T>, ctx?: object): Node<T> | undefined;
@@ -36,6 +36,7 @@ declare namespace TreeModel {
drop(): Node<T>;
[propName: string]: any;
+ children?: Array<Node<T>>
}
interface Config {
This issue body was partially generated by patch-package.
Would you like to have a PR for that?
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
tree-model@1.0.7for the project I'm working on.node.all()which currently throws a typing error as it always expects at least 1 optionnode.childrenso when iterating you do not get a typing errorHere is the diff that solved my problem:
This issue body was partially generated by patch-package.
Would you like to have a PR for that?