Initial work on enabling strict nulls in azurecore (#20411)

This commit is contained in:
Charles Gagnon
2022-08-24 10:59:25 -07:00
committed by GitHub
parent 65aa98597d
commit a7e5acf539
12 changed files with 60 additions and 59 deletions

View File

@@ -18,13 +18,13 @@ export abstract class TreeNode {
return path;
}
public findNodeByPath(path: string, expandIfNeeded: boolean = false): Promise<TreeNode> {
public findNodeByPath(path: string, expandIfNeeded: boolean = false): Promise<TreeNode | undefined> {
let condition: TreeNodePredicate = (node: TreeNode) => node.getNodeInfo().nodePath === path;
let filter: TreeNodePredicate = (node: TreeNode) => path.startsWith(node.getNodeInfo().nodePath);
return TreeNode.findNode(this, condition, filter, true);
}
public static async findNode(node: TreeNode, condition: TreeNodePredicate, filter: TreeNodePredicate, expandIfNeeded: boolean): Promise<TreeNode> {
public static async findNode(node: TreeNode, condition: TreeNodePredicate, filter: TreeNodePredicate, expandIfNeeded: boolean): Promise<TreeNode | undefined> {
if (!node) {
return undefined;
}
@@ -53,13 +53,7 @@ export abstract class TreeNode {
return undefined;
}
public get parent(): TreeNode {
return this._parent;
}
public set parent(node: TreeNode) {
this._parent = node;
}
public parent: TreeNode | undefined = undefined;
public abstract getChildren(refreshChildren: boolean): TreeNode[] | Promise<TreeNode[]>;
public abstract getTreeItem(): vscode.TreeItem | Promise<vscode.TreeItem>;
@@ -70,6 +64,4 @@ export abstract class TreeNode {
* The value to use for this node in the node path
*/
public abstract get nodePathValue(): string;
private _parent: TreeNode = undefined;
}