Socket
Socket
Sign inDemoInstall

@reach/utils

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/utils - npm Package Compare versions

Comparing version 0.15.0 to 0.15.2

48

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

@@ -13,2 +12,5 @@ * Infers `OwnProps` if E is a ForwardRefComponent

declare type NarrowIntrinsic<E> = E extends keyof JSX.IntrinsicElements ? E : never;
declare type ForwardRefExoticComponent<E, OwnProps> = React.ForwardRefExoticComponent<Merge<E extends React.ElementType ? React.ComponentPropsWithRef<E> : never, OwnProps & {
as?: E;
}>>;
/**

@@ -18,40 +20,18 @@ * Extends original type to ensure built in React types play nice with

*/
interface ForwardRefComponent<IntrinsicElementString, OwnProps = {}> extends React.ForwardRefExoticComponent<MergeProps<IntrinsicElementString, OwnProps & {
as?: IntrinsicElementString;
}>> {
<As extends keyof JSX.IntrinsicElements = NarrowIntrinsic<IntrinsicElementString>>(props: MergeProps<As, OwnProps & {
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: 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;
}
interface MemoComponent<IntrinsicElementString, OwnProps = {}> extends React.MemoExoticComponent<ForwardRefComponent<MergeProps<IntrinsicElementString, OwnProps & {
as?: IntrinsicElementString;
}>>> {
<As extends keyof JSX.IntrinsicElements = NarrowIntrinsic<IntrinsicElementString>>(props: MergeProps<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?: As;
}>): 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: As;
}> : As extends React.JSXElementConstructor<infer P> ? Merge<P, OwnProps & {
as: As;
}> : never): React.ReactElement | null;
}
export type { ForwardRefComponent, MemoComponent, OwnProps, IntrinsicElement, Merge, };
export type { ForwardRefComponent, IntrinsicElement, MemoComponent, Merge, OwnProps, };
declare const _default: {};
export default _default;
{
"name": "@reach/utils",
"version": "0.15.0",
"version": "0.15.2",
"description": "Internal, shared utilities for Reach UI.",

@@ -14,3 +14,3 @@ "author": "React Training <hello@reacttraining.com>",

"tiny-warning": "^1.0.3",
"tslib": "^2.1.0"
"tslib": "^2.3.0"
},

@@ -95,3 +95,3 @@ "devDependencies": {

},
"gitHead": "1449650359c119c1afe25973aa7584e09e2c88bc"
"gitHead": "353f409a296a648c4fe2c2d06b14a39b7b6dc3e1"
}
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