Socket
Socket
Sign inDemoInstall

@radix-ui/react-polymorphic

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-polymorphic - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

29

dist/index.d.ts
import * as React from "react";
export type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2;
type MergeProps<E, P = {}> = P & Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, P>;
/**

@@ -13,2 +12,5 @@ * Infers the OwnProps if E is a ForwardRefExoticComponentWithAs

type NarrowIntrinsic<E> = E extends keyof JSX.IntrinsicElements ? E : never;
type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
as?: E;
}>>;
export interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}

@@ -19,29 +21,18 @@ /**

*/
> extends React.ForwardRefExoticComponent<MergeProps<IntrinsicElementString, OwnProps & {
as?: IntrinsicElementString;
}>> {
> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> {
/**
* When passing an `as` prop as a string, use this overload.
* When `as` prop is passed, use this overload.
* Merges original own props (without DOM props) and the inferred props
* from `as` element with the own props taking precendence.
*
* We explicitly define a `JSX.IntrinsicElements` overload so that
* events are typed for consumers.
* We explicitly avoid `React.ElementType` and manually narrow the prop types
* so that events are typed when using JSX.IntrinsicElements.
*/
<As extends keyof JSX.IntrinsicElements = NarrowIntrinsic<IntrinsicElementString>>(props: MergeProps<As, OwnProps & {
<As extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any> = NarrowIntrinsic<IntrinsicElementString>>(props: As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
as: As;
}>): React.ReactElement | null;
/**
* When passing an `as` prop as a component, use this overload.
* Merges original own props (without DOM props) and the inferred props
* from `as` element with the own props taking precendence.
*
* We don't use `React.ComponentType` here as we get type errors
* when consumers try to do inline `as` components.
*/
<As extends React.ElementType>(props: MergeProps<As, OwnProps & {
}> : As extends React.JSXElementConstructor<infer P> ? Merge<P, OwnProps & {
as: As;
}>): React.ReactElement | null;
}> : never): React.ReactElement | null;
}
//# sourceMappingURL=index.d.ts.map
{
"name": "@radix-ui/react-polymorphic",
"version": "0.0.10",
"version": "0.0.11",
"license": "MIT",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

@@ -13,2 +13,2 @@ # `react-polymorphic`

This is an internal utility, not intended for public usage.
View docs [here](https://radix-ui.com/primitives/docs/utilities/polymorphic).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc