@reach/utils
Advanced tools
Comparing version 0.15.2 to 0.15.3
import type * as React from "react"; | ||
declare type Merge<P1 = {}, P2 = {}> = Omit<P1, keyof P2> & P2; | ||
/** | ||
* Infers `OwnProps` if E is a ForwardRefComponent | ||
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
declare type OwnProps<E> = E extends ForwardRefComponent<any, infer P> ? P : {}; | ||
/** | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefComponent | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
@@ -15,10 +15,6 @@ declare type IntrinsicElement<E> = E extends ForwardRefComponent<infer I, any> ? I : never; | ||
}>>; | ||
/** | ||
* Extends original type to ensure built in React types play nice with | ||
* polymorphic components still e.g. `React.ElementRef` etc. | ||
*/ | ||
interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends ForwardRefExoticComponent<IntrinsicElementString, OwnProps> { | ||
<As extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any> = NarrowIntrinsic<IntrinsicElementString>>(props: As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & { | ||
<As extends keyof JSX.IntrinsicElements | React.ComponentType<any> = NarrowIntrinsic<IntrinsicElementString>>(props: As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & { | ||
as: As; | ||
}> : As extends React.JSXElementConstructor<infer P> ? Merge<P, OwnProps & { | ||
}> : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & { | ||
as: As; | ||
@@ -28,5 +24,5 @@ }> : never): React.ReactElement | null; | ||
interface MemoComponent<IntrinsicElementString, OwnProps = {}> extends React.MemoExoticComponent<ForwardRefComponent<IntrinsicElementString, OwnProps>> { | ||
<As extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any> = NarrowIntrinsic<IntrinsicElementString>>(props: As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & { | ||
<As extends keyof JSX.IntrinsicElements | React.ComponentType<any> = NarrowIntrinsic<IntrinsicElementString>>(props: As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & { | ||
as: As; | ||
}> : As extends React.JSXElementConstructor<infer P> ? Merge<P, OwnProps & { | ||
}> : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & { | ||
as: As; | ||
@@ -33,0 +29,0 @@ }> : never): React.ReactElement | null; |
{ | ||
"name": "@reach/utils", | ||
"version": "0.15.2", | ||
"version": "0.15.3", | ||
"description": "Internal, shared utilities for Reach UI.", | ||
@@ -94,3 +94,3 @@ "author": "React Training <hello@reacttraining.com>", | ||
}, | ||
"gitHead": "353f409a296a648c4fe2c2d06b14a39b7b6dc3e1" | ||
"gitHead": "aac3d3e1902ec32656476bcdccd7b56207384fcd" | ||
} |
@@ -8,19 +8,14 @@ 'use strict'; | ||
// (rightfully) treating it as an internal utility, so copy/paste it is to | ||
// prevent any needless churn if they make breaking changes. | ||
// Big thanks to Jenna for the heavy lifting! https://github.com/jjenzz | ||
// prevent any needless churn if they make breaking changes. Big thanks to Jenna | ||
// for the heavy lifting! https://github.com/jjenzz | ||
/** | ||
* Infers `OwnProps` if E is a ForwardRefComponent | ||
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
/** | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefComponent | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
/** | ||
* Extends original type to ensure built in React types play nice with | ||
* polymorphic components still e.g. `React.ElementRef` etc. | ||
*/ | ||
var polymorphic = {}; | ||
exports.default = polymorphic; |
@@ -8,19 +8,14 @@ 'use strict'; | ||
// (rightfully) treating it as an internal utility, so copy/paste it is to | ||
// prevent any needless churn if they make breaking changes. | ||
// Big thanks to Jenna for the heavy lifting! https://github.com/jjenzz | ||
// prevent any needless churn if they make breaking changes. Big thanks to Jenna | ||
// for the heavy lifting! https://github.com/jjenzz | ||
/** | ||
* Infers `OwnProps` if E is a ForwardRefComponent | ||
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
/** | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefComponent | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
/** | ||
* Extends original type to ensure built in React types play nice with | ||
* polymorphic components still e.g. `React.ElementRef` etc. | ||
*/ | ||
var polymorphic = {}; | ||
exports.default = polymorphic; |
// adapted from https://github.com/radix-ui/primitives/blob/2f139a832ba0cdfd445c937ebf63c2e79e0ef7ed/packages/react/polymorphic/src/polymorphic.ts | ||
// Would have liked to use it directly instead of copying but they are | ||
// (rightfully) treating it as an internal utility, so copy/paste it is to | ||
// prevent any needless churn if they make breaking changes. | ||
// Big thanks to Jenna for the heavy lifting! https://github.com/jjenzz | ||
// prevent any needless churn if they make breaking changes. Big thanks to Jenna | ||
// for the heavy lifting! https://github.com/jjenzz | ||
/** | ||
* Infers `OwnProps` if E is a ForwardRefComponent | ||
* Infers the OwnProps if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
/** | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefComponent | ||
* Infers the JSX.IntrinsicElement if E is a ForwardRefExoticComponentWithAs | ||
*/ | ||
/** | ||
* Extends original type to ensure built in React types play nice with | ||
* polymorphic components still e.g. `React.ElementRef` etc. | ||
*/ | ||
var polymorphic = {}; | ||
export default polymorphic; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115482
2790