diff --git a/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue b/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue index 3f1aa02021..2ead1a5188 100644 --- a/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue +++ b/src/components/sidebar/tabs/ModelLibrarySidebarTab.vue @@ -136,14 +136,13 @@ const renderedRoot = computed>(() => { } return 'pi pi-folder' }, - // @ts-expect-error fixme ts strict error getBadgeText() { - // Return null to apply default badge text + // Return undefined to apply default badge text // Return empty string to hide badge if (!folder) { - return null + return } - return folder.state === ResourceState.Loaded ? null : '' + return folder.state === ResourceState.Loaded ? undefined : '' }, children, draggable: node.leaf, diff --git a/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue b/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue index 0d9fa03be1..0284792815 100644 --- a/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue +++ b/src/components/sidebar/tabs/NodeLibrarySidebarTab.vue @@ -117,7 +117,6 @@ const renderedRoot = computed>(() => { // @ts-expect-error fixme ts strict error leaf: node.leaf, data: node.data, - // @ts-expect-error fixme ts strict error getIcon() { if (this.leaf) { return 'pi pi-circle-fill' diff --git a/src/types/treeExplorerTypes.ts b/src/types/treeExplorerTypes.ts index c2d5c1a786..bce7e8a44e 100644 --- a/src/types/treeExplorerTypes.ts +++ b/src/types/treeExplorerTypes.ts @@ -8,10 +8,17 @@ export interface TreeExplorerNode { data?: T children?: TreeExplorerNode[] icon?: string - /** Function to override what icon to use for the node */ - getIcon?: (this: TreeExplorerNode) => string - /** Function to override what text to use for the leaf-count badge on a folder node */ - getBadgeText?: (this: TreeExplorerNode) => string + /** + * Function to override what icon to use for the node. + * Return undefined to fallback to {@link icon} property. + */ + getIcon?: (this: TreeExplorerNode) => string | undefined + /** + * Function to override what text to use for the leaf-count badge on a folder node. + * Return undefined to fallback to default badge text, which is the subtree's leaf count. + * Return empty string to hide the badge. + */ + getBadgeText?: (this: TreeExplorerNode) => string | undefined /** Function to handle renaming the node */ handleRename?: ( this: TreeExplorerNode,