Skip to content

Commit 9f80d96

Browse files
committed
revert(react-utilities): undo using custom RefAttibute for getIntrinsicElementProps
1 parent 551de71 commit 9f80d96

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
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
@@ -72,7 +72,7 @@ export function getEventClientCoords(event: TouchOrMouseEvent): {
7272
};
7373

7474
// @public
75-
export const getIntrinsicElementProps: <Props extends UnknownSlotProps, ExcludedPropKeys extends Extract<keyof Props, string> = never>(tagName: NonNullable<Props["as"]>, props: Props & RefAttributes<InferredElementRefType<Props>>, excludedPropNames?: ExcludedPropKeys[] | undefined) => DistributiveOmit<Props, ExcludedPropKeys | Exclude<keyof Props, "as" | keyof HTMLAttributes>>;
75+
export const getIntrinsicElementProps: <Props extends UnknownSlotProps, ExcludedPropKeys extends Extract<keyof Props, string> = never>(tagName: NonNullable<Props["as"]>, props: Props & React_2.RefAttributes<InferredElementRefType<Props>>, excludedPropNames?: ExcludedPropKeys[] | undefined) => DistributiveOmit<Props, ExcludedPropKeys | Exclude<keyof Props, "as" | keyof HTMLAttributes>>;
7676

7777
// @public @deprecated
7878
export function getNativeElementProps<TAttributes extends React_2.HTMLAttributes<any>>(tagName: string, props: {}, excludedPropNames?: string[]): TAttributes;

packages/react-components/react-utilities/src/compose/getIntrinsicElementProps.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { getNativeElementProps } from '../utils/getNativeElementProps';
33
import type { InferredElementRefType, UnknownSlotProps } from './types';
4-
import type { DistributiveOmit, RefAttributes } from '../utils/types';
4+
import type { DistributiveOmit } from '../utils/types';
55

66
// eslint-disable-next-line @typescript-eslint/no-explicit-any
77
type HTMLAttributes = React.HTMLAttributes<any>;
@@ -11,16 +11,18 @@ type HTMLAttributes = React.HTMLAttributes<any>;
1111
* element type.
1212
*
1313
* Equivalent to {@link getNativeElementProps}, but more type-safe.
14+
*
15+
* @param tagName - The slot's default element type (e.g. 'div')
16+
* @param props - The component's props object
17+
* @param excludedPropNames - List of native props to exclude from the returned value
1418
*/
1519
export const getIntrinsicElementProps = <
1620
Props extends UnknownSlotProps,
1721
ExcludedPropKeys extends Extract<keyof Props, string> = never,
1822
>(
19-
/** The slot's default element type (e.g. 'div') */
2023
tagName: NonNullable<Props['as']>,
21-
/** The component's props object */
22-
props: Props & RefAttributes<InferredElementRefType<Props>>,
23-
/** List of native props to exclude from the returned value */
24+
// eslint-disable-next-line @typescript-eslint/no-restricted-types -- in order to not introduce Type Restriction CHANGe which is kinda "breaking change from Types POV", we don't enforce our custom `RefAttributes` in this API, to be compatible with scenarios where non v9 interfaces might be used. This may/will change with React 19
25+
props: Props & React.RefAttributes<InferredElementRefType<Props>>,
2426
excludedPropNames?: ExcludedPropKeys[],
2527
) => {
2628
// eslint-disable-next-line @typescript-eslint/no-deprecated

0 commit comments

Comments
 (0)