diff --git a/docs/pages/x/api/tree-view/tree-view.json b/docs/pages/x/api/tree-view/tree-view.json index ba89444fb66b..2d4f79111ff9 100644 --- a/docs/pages/x/api/tree-view/tree-view.json +++ b/docs/pages/x/api/tree-view/tree-view.json @@ -11,7 +11,10 @@ }, "defaultExpandIcon": { "type": { "name": "node" } }, "defaultParentIcon": { "type": { "name": "node" } }, - "defaultSelected": { "type": { "name": "any" }, "default": "[]" }, + "defaultSelected": { + "type": { "name": "union", "description": "Array<string>
| string" }, + "default": "[]" + }, "disabledItemsFocusable": { "type": { "name": "bool" } }, "disableSelection": { "type": { "name": "bool" } }, "expanded": { "type": { "name": "arrayOf", "description": "Array<string>" } }, diff --git a/packages/x-tree-view/src/TreeView/TreeView.tsx b/packages/x-tree-view/src/TreeView/TreeView.tsx index cde3ba702c15..1e71a3d87831 100644 --- a/packages/x-tree-view/src/TreeView/TreeView.tsx +++ b/packages/x-tree-view/src/TreeView/TreeView.tsx @@ -159,7 +159,10 @@ TreeView.propTypes = { * When `multiSelect` is true this takes an array of strings; when false (default) a string. * @default [] */ - defaultSelected: PropTypes.any, + defaultSelected: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.arrayOf(PropTypes.string), + PropTypes.string, + ]), /** * If `true`, will allow focus on disabled items. * @default false