|
1 | 1 | import * as React from 'react';
|
2 | 2 | import { omit } from '../../utils/omit';
|
3 |
| -import type { |
4 |
| - AsIntrinsicElement, |
5 |
| - ComponentState, |
6 |
| - ExtractSlotProps, |
7 |
| - SlotPropsRecord, |
8 |
| - SlotRenderFunction, |
9 |
| - UnknownSlotProps, |
10 |
| -} from '../types'; |
| 3 | +import type { ComponentState, SlotPropsRecord, SlotRenderFunction, UnknownSlotProps } from '../types'; |
11 | 4 | import { isSlot } from '../isSlot';
|
12 | 5 | import { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';
|
13 |
| -import { UnionToIntersection } from '../../utils/types'; |
14 | 6 |
|
15 | 7 | /**
|
16 | 8 | * @deprecated - use slot.always or slot.optional combined with assertSlots instead
|
17 | 9 | */
|
18 | 10 | export type Slots<S extends SlotPropsRecord> = {
|
19 |
| - [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> |
20 |
| - ? // for slots with an `as` prop, the slot will be any one of the possible values of `as` |
21 |
| - As |
22 |
| - : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> |
23 |
| - ? React.ElementType<NonNullable<P>> |
24 |
| - : React.ElementType<ExtractSlotProps<S[K]>>; |
| 11 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 12 | + [K in keyof S]: React.ElementType<any>; |
25 | 13 | };
|
26 | 14 |
|
27 | 15 | /**
|
28 | 16 | * @deprecated - use slot.always or slot.optional combined with assertSlots instead
|
29 | 17 | */
|
30 | 18 | export type ObjectSlotProps<S extends SlotPropsRecord> = {
|
31 |
| - [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> |
32 |
| - ? // For intrinsic element types, return the intersection of all possible |
33 |
| - // element's props, to be compatible with the As type returned by Slots<> |
34 |
| - UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'> |
35 |
| - : ExtractSlotProps<S[K]> extends React.ComponentType<infer P> |
36 |
| - ? P // Slot<typeof Button> |
37 |
| - : ExtractSlotProps<S[K]>; // Slot<ButtonProps> |
| 19 | + // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 20 | + [K in keyof S]-?: any; // Slot<ButtonProps> |
38 | 21 | };
|
39 | 22 |
|
40 | 23 | /**
|
|
0 commit comments