Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
romgrk committed Jan 7, 2025
1 parent fba41fe commit 6ad77ae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/x-data-grid/src/models/gridSlotsComponentsProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,17 @@ interface ElementSlotProps {
}

// Merge MUI types into base types to keep slotProps working.
type Select<A, B, K> = K extends keyof A ? A[K] : K extends keyof B ? B[K] : never;
type Merge<A, B> = {
[K in keyof A | keyof B]: K extends keyof A ? A[K] : K extends keyof B ? B[K] : never;
[K in keyof A | keyof B]: K extends 'ref'
? Select<A, B, 'ref'>
: K extends keyof A & keyof B
? A[K] & B[K]
: K extends keyof B
? B[K]
: K extends keyof A
? A[K]
: never;
};
export type GridSlotProps = Merge<BaseSlotProps, MaterialSlotProps> & ElementSlotProps;

Expand Down

0 comments on commit 6ad77ae

Please sign in to comment.