Skip to content

Commit a7919ba

Browse files
bsunderhusmainframev
authored andcommitted
chore: loosen types for deprecated API
1 parent 395f5c2 commit a7919ba

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

packages/react-components/react-utilities/etc/react-utilities.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export type SlotRenderFunction<Props> = (Component: React_2.ElementType<Props>,
300300

301301
// @public @deprecated (undocumented)
302302
export type Slots<S extends SlotPropsRecord> = {
303-
[K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? React_2.ElementType<NonNullable<P>> : React_2.ElementType<ExtractSlotProps<S[K]>>;
303+
[K in keyof S]: React_2.ElementType<any>;
304304
};
305305

306306
// @public

packages/react-components/react-utilities/src/compose/deprecated/getSlots.ts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
11
import * as React from 'react';
22
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';
114
import { isSlot } from '../isSlot';
125
import { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';
13-
import { UnionToIntersection } from '../../utils/types';
146

157
/**
168
* @deprecated - use slot.always or slot.optional combined with assertSlots instead
179
*/
1810
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>;
2513
};
2614

2715
/**
2816
* @deprecated - use slot.always or slot.optional combined with assertSlots instead
2917
*/
3018
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>
3821
};
3922

4023
/**

0 commit comments

Comments
 (0)