Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/x-tree-view/src/internals/models/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export type TreeViewPluginSignature<
>;
}
: {};
experimentalFeatures: T['experimentalFeatures'];
experimentalFeatures: T extends { experimentalFeatures: string }
? { [key in T['experimentalFeatures']]?: boolean }
: {};
dependencies: T extends { dependencies: Array<any> } ? T['dependencies'] : [];
optionalDependencies: T extends { optionalDependencies: Array<any> }
? T['optionalDependencies']
Expand Down
3 changes: 2 additions & 1 deletion packages/x-tree-view/src/internals/models/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ export type TreeViewPublicAPI<

export type TreeViewExperimentalFeatures<
TSignatures extends readonly TreeViewAnyPluginSignature[],
> = { [key in MergeSignaturesProperty<TSignatures, 'experimentalFeatures'>]?: boolean };
TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = [],
> = MergeSignaturesProperty<[...TSignatures, ...TOptionalSignatures], 'experimentalFeatures'>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also added support for the optional plugins even if we never use it for now, just to be consistent with the instance and params

Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ export const extractPluginParamsFromProps = <
pluginParams: defaultizedPluginParams,
slots: slots ?? ({} as any),
slotProps: slotProps ?? ({} as any),
experimentalFeatures: experimentalFeatures ?? {},
experimentalFeatures: experimentalFeatures ?? ({} as any),
};
};