@mui/types
Advanced tools
+93
| import * as React from 'react'; | ||
| export {}; | ||
| /** | ||
| * `T extends ConsistentWith<T, U>` means that where `T` has overlapping properties with | ||
| * `U`, their value types do not conflict. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type ConsistentWith<DecorationTargetProps, InjectedProps> = { [P in keyof DecorationTargetProps]: P extends keyof InjectedProps ? InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : InjectedProps[P] : DecorationTargetProps[P] }; | ||
| /** | ||
| * a function that takes {component} and returns a component that passes along | ||
| * all the props to {component} except the {InjectedProps} and will accept | ||
| * additional {AdditionalProps} | ||
| */ | ||
| export type PropInjector<InjectedProps, AdditionalProps = {}> = <C extends React.JSXElementConstructor<ConsistentWith<React.ComponentProps<C>, InjectedProps>>>(component: C) => React.JSXElementConstructor<DistributiveOmit<React.JSX.LibraryManagedAttributes<C, React.ComponentProps<C>>, keyof InjectedProps> & AdditionalProps>; | ||
| /** | ||
| * Remove properties `K` from `T`. | ||
| * Distributive for union types. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never; | ||
| /** | ||
| * Generate a set of string literal types with the given default record `T` and | ||
| * override record `U`. | ||
| * | ||
| * If the property value was `true`, the property key will be added to the | ||
| * string union. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type OverridableStringUnion<T extends string | number, U = {}> = GenerateStringUnion<Overwrite<Record<T, true>, U>>; | ||
| /** | ||
| * Like `T & U`, but using the value types from `U` where their properties overlap. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type Overwrite<T, U> = DistributiveOmit<T, keyof U> & U; | ||
| type GenerateStringUnion<T> = Extract<{ [Key in keyof T]: true extends T[Key] ? Key : never }[keyof T], string>; | ||
| export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends (<G>() => G extends U ? 1 : 2) ? Y : N; | ||
| /** | ||
| * Issues a type error if `Expected` is not identical to `Actual`. | ||
| * | ||
| * `Expected` should be declared when invoking `expectType`. | ||
| * `Actual` should almost always we be a `typeof value` statement. | ||
| * | ||
| * @example `expectType<number | string, typeof value>(value)` | ||
| * TypeScript issues a type error since `value is not assignable to never`. | ||
| * This means `typeof value` is not identical to `number | string` | ||
| * @param actual | ||
| */ | ||
| export declare function expectType<Expected, Actual>(actual: IfEquals<Actual, Expected, Actual>): void; | ||
| /** | ||
| * A component whose root component can be controlled via a `component` prop. | ||
| * | ||
| * Adjusts valid props based on the type of `component`. | ||
| */ | ||
| export interface OverridableComponent<M extends OverridableTypeMap> { | ||
| <C extends React.ElementType>(props: { | ||
| /** | ||
| * The component used for the root node. | ||
| * Either a string to use a HTML element or a component. | ||
| */ | ||
| component: C; | ||
| } & OverrideProps<M, C>): React.JSX.Element | null; | ||
| (props: DefaultComponentProps<M>): React.JSX.Element | null; | ||
| propTypes?: any; | ||
| } | ||
| /** | ||
| * Props of the component if `component={Component}` is used. | ||
| */ | ||
| export type OverrideProps<M extends OverridableTypeMap, C extends React.ElementType> = (BaseProps<M> & DistributiveOmit<React.ComponentPropsWithRef<C>, keyof BaseProps<M>>); | ||
| /** | ||
| * Props if `component={Component}` is NOT used. | ||
| */ | ||
| export type DefaultComponentProps<M extends OverridableTypeMap> = BaseProps<M> & DistributiveOmit<React.ComponentPropsWithRef<M['defaultComponent']>, keyof BaseProps<M>>; | ||
| /** | ||
| * Props defined on the component. | ||
| */ | ||
| export type BaseProps<M extends OverridableTypeMap> = M['props']; | ||
| export interface OverridableTypeMap { | ||
| props: {}; | ||
| defaultComponent: React.ElementType; | ||
| } | ||
| /** | ||
| * Simplifies the display of a type (without modifying it). | ||
| * Taken from https://effectivetypescript.com/2022/02/25/gentips-4-display/ | ||
| */ | ||
| export type Simplify<T> = T extends Function ? T : { [K in keyof T]: T[K] }; | ||
| /** | ||
| * Changes the properties K from T to required | ||
| */ | ||
| export type PartiallyRequired<T, K extends keyof T> = DistributiveOmit<T, K> & { [P in K]-?: T[P] }; |
+89
| /** | ||
| * @mui/types v9.0.0-alpha.1 | ||
| * | ||
| * @license MIT | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| // disable automatic export | ||
| export {}; | ||
| /** | ||
| * `T extends ConsistentWith<T, U>` means that where `T` has overlapping properties with | ||
| * `U`, their value types do not conflict. | ||
| * | ||
| * @internal | ||
| */ | ||
| /** | ||
| * a function that takes {component} and returns a component that passes along | ||
| * all the props to {component} except the {InjectedProps} and will accept | ||
| * additional {AdditionalProps} | ||
| */ | ||
| /** | ||
| * Remove properties `K` from `T`. | ||
| * Distributive for union types. | ||
| * | ||
| * @internal | ||
| */ | ||
| /** | ||
| * Generate a set of string literal types with the given default record `T` and | ||
| * override record `U`. | ||
| * | ||
| * If the property value was `true`, the property key will be added to the | ||
| * string union. | ||
| * | ||
| * @internal | ||
| */ | ||
| /** | ||
| * Like `T & U`, but using the value types from `U` where their properties overlap. | ||
| * | ||
| * @internal | ||
| */ | ||
| // https://stackoverflow.com/questions/53807517/how-to-test-if-two-types-are-exactly-the-same | ||
| /** | ||
| * Issues a type error if `Expected` is not identical to `Actual`. | ||
| * | ||
| * `Expected` should be declared when invoking `expectType`. | ||
| * `Actual` should almost always we be a `typeof value` statement. | ||
| * | ||
| * @example `expectType<number | string, typeof value>(value)` | ||
| * TypeScript issues a type error since `value is not assignable to never`. | ||
| * This means `typeof value` is not identical to `number | string` | ||
| * @param actual | ||
| */ | ||
| /** | ||
| * A component whose root component can be controlled via a `component` prop. | ||
| * | ||
| * Adjusts valid props based on the type of `component`. | ||
| */ | ||
| /** | ||
| * Props of the component if `component={Component}` is used. | ||
| */ | ||
| // prettier-ignore | ||
| /** | ||
| * Props if `component={Component}` is NOT used. | ||
| */ | ||
| // prettier-ignore | ||
| /** | ||
| * Props defined on the component. | ||
| */ | ||
| // prettier-ignore | ||
| /** | ||
| * Simplifies the display of a type (without modifying it). | ||
| * Taken from https://effectivetypescript.com/2022/02/25/gentips-4-display/ | ||
| */ | ||
| /** | ||
| * Changes the properties K from T to required | ||
| */ |
| import * as React from 'react'; | ||
| declare module '@mui/types' { | ||
| /** | ||
| * A component whose root component can be controlled via a `component` prop. | ||
| * | ||
| * Adjusts valid props based on the type of `component`. | ||
| */ | ||
| interface OverridableComponent<M extends OverridableTypeMap> { | ||
| <C extends React.ElementType>(props: { | ||
| /** | ||
| * The component used for the root node. | ||
| * Either a string to use a HTML element or a component. | ||
| */ | ||
| component: C; | ||
| } & OverridePropsVer2<M, C>): React.JSX.Element; | ||
| (props: DefaultComponentPropsVer2<M>): React.JSX.Element; | ||
| propTypes?: any; | ||
| } | ||
| /** | ||
| * Props of the component if `component={Component}` is used. | ||
| */ | ||
| type OverridePropsVer2<M extends OverridableTypeMap, C extends React.ElementType> = (BaseProps<M> & DistributiveOmit<React.ComponentPropsWithoutRef<C>, keyof BaseProps<M>> & { | ||
| ref?: (React.Ref<Element>) | undefined; | ||
| }); | ||
| /** | ||
| * Props if `component={Component}` is NOT used. | ||
| */ | ||
| type DefaultComponentPropsVer2<M extends OverridableTypeMap> = BaseProps<M> & DistributiveOmit<React.ComponentPropsWithoutRef<M['defaultComponent']>, keyof BaseProps<M>> & { | ||
| ref?: (React.Ref<Element>) | undefined; | ||
| }; | ||
| } |
| export {}; |
+1
-1
| /** | ||
| * @mui/types v9.0.0-alpha.0 | ||
| * @mui/types v9.0.0-alpha.1 | ||
| * | ||
@@ -4,0 +4,0 @@ * @license MIT |
@@ -23,3 +23,3 @@ import * as React from 'react'; | ||
| type OverridePropsVer2<M extends OverridableTypeMap, C extends React.ElementType> = (BaseProps<M> & DistributiveOmit<React.ComponentPropsWithoutRef<C>, keyof BaseProps<M>> & { | ||
| ref?: React.Ref<Element>; | ||
| ref?: (React.Ref<Element>) | undefined; | ||
| }); | ||
@@ -30,4 +30,4 @@ /** | ||
| type DefaultComponentPropsVer2<M extends OverridableTypeMap> = BaseProps<M> & DistributiveOmit<React.ComponentPropsWithoutRef<M['defaultComponent']>, keyof BaseProps<M>> & { | ||
| ref?: React.Ref<Element>; | ||
| ref?: (React.Ref<Element>) | undefined; | ||
| }; | ||
| } |
+11
-8
| { | ||
| "name": "@mui/types", | ||
| "version": "9.0.0-alpha.0", | ||
| "version": "9.0.0-alpha.1", | ||
| "author": "MUI Team", | ||
@@ -38,7 +38,9 @@ "description": "Utility types for Material UI.", | ||
| "type": "commonjs", | ||
| "main": "./index.js", | ||
| "types": "./index.d.ts", | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": { | ||
| "import": { | ||
| "types": "./index.d.mts", | ||
| "default": "./index.mjs" | ||
| }, | ||
| "require": { | ||
@@ -49,8 +51,9 @@ "types": "./index.d.ts", | ||
| "default": { | ||
| "types": "./esm/index.d.ts", | ||
| "default": "./esm/index.js" | ||
| "types": "./index.d.mts", | ||
| "default": "./index.mjs" | ||
| } | ||
| }, | ||
| "./esm": null | ||
| } | ||
| } | ||
| }, | ||
| "main": "./index.js", | ||
| "types": "./index.d.ts" | ||
| } |
| import * as React from 'react'; | ||
| export {}; | ||
| /** | ||
| * `T extends ConsistentWith<T, U>` means that where `T` has overlapping properties with | ||
| * `U`, their value types do not conflict. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type ConsistentWith<DecorationTargetProps, InjectedProps> = { [P in keyof DecorationTargetProps]: P extends keyof InjectedProps ? InjectedProps[P] extends DecorationTargetProps[P] ? DecorationTargetProps[P] : InjectedProps[P] : DecorationTargetProps[P] }; | ||
| /** | ||
| * a function that takes {component} and returns a component that passes along | ||
| * all the props to {component} except the {InjectedProps} and will accept | ||
| * additional {AdditionalProps} | ||
| */ | ||
| export type PropInjector<InjectedProps, AdditionalProps = {}> = <C extends React.JSXElementConstructor<ConsistentWith<React.ComponentProps<C>, InjectedProps>>>(component: C) => React.JSXElementConstructor<DistributiveOmit<React.JSX.LibraryManagedAttributes<C, React.ComponentProps<C>>, keyof InjectedProps> & AdditionalProps>; | ||
| /** | ||
| * Remove properties `K` from `T`. | ||
| * Distributive for union types. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never; | ||
| /** | ||
| * Generate a set of string literal types with the given default record `T` and | ||
| * override record `U`. | ||
| * | ||
| * If the property value was `true`, the property key will be added to the | ||
| * string union. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type OverridableStringUnion<T extends string | number, U = {}> = GenerateStringUnion<Overwrite<Record<T, true>, U>>; | ||
| /** | ||
| * Like `T & U`, but using the value types from `U` where their properties overlap. | ||
| * | ||
| * @internal | ||
| */ | ||
| export type Overwrite<T, U> = DistributiveOmit<T, keyof U> & U; | ||
| type GenerateStringUnion<T> = Extract<{ [Key in keyof T]: true extends T[Key] ? Key : never }[keyof T], string>; | ||
| export type IfEquals<T, U, Y = unknown, N = never> = (<G>() => G extends T ? 1 : 2) extends (<G>() => G extends U ? 1 : 2) ? Y : N; | ||
| /** | ||
| * Issues a type error if `Expected` is not identical to `Actual`. | ||
| * | ||
| * `Expected` should be declared when invoking `expectType`. | ||
| * `Actual` should almost always we be a `typeof value` statement. | ||
| * | ||
| * @example `expectType<number | string, typeof value>(value)` | ||
| * TypeScript issues a type error since `value is not assignable to never`. | ||
| * This means `typeof value` is not identical to `number | string` | ||
| * @param actual | ||
| */ | ||
| export declare function expectType<Expected, Actual>(actual: IfEquals<Actual, Expected, Actual>): void; | ||
| /** | ||
| * A component whose root component can be controlled via a `component` prop. | ||
| * | ||
| * Adjusts valid props based on the type of `component`. | ||
| */ | ||
| export interface OverridableComponent<M extends OverridableTypeMap> { | ||
| <C extends React.ElementType>(props: { | ||
| /** | ||
| * The component used for the root node. | ||
| * Either a string to use a HTML element or a component. | ||
| */ | ||
| component: C; | ||
| } & OverrideProps<M, C>): React.JSX.Element | null; | ||
| (props: DefaultComponentProps<M>): React.JSX.Element | null; | ||
| propTypes?: any; | ||
| } | ||
| /** | ||
| * Props of the component if `component={Component}` is used. | ||
| */ | ||
| export type OverrideProps<M extends OverridableTypeMap, C extends React.ElementType> = (BaseProps<M> & DistributiveOmit<React.ComponentPropsWithRef<C>, keyof BaseProps<M>>); | ||
| /** | ||
| * Props if `component={Component}` is NOT used. | ||
| */ | ||
| export type DefaultComponentProps<M extends OverridableTypeMap> = BaseProps<M> & DistributiveOmit<React.ComponentPropsWithRef<M['defaultComponent']>, keyof BaseProps<M>>; | ||
| /** | ||
| * Props defined on the component. | ||
| */ | ||
| export type BaseProps<M extends OverridableTypeMap> = M['props']; | ||
| export interface OverridableTypeMap { | ||
| props: {}; | ||
| defaultComponent: React.ElementType; | ||
| } | ||
| /** | ||
| * Simplifies the display of a type (without modifying it). | ||
| * Taken from https://effectivetypescript.com/2022/02/25/gentips-4-display/ | ||
| */ | ||
| export type Simplify<T> = T extends Function ? T : { [K in keyof T]: T[K] }; | ||
| /** | ||
| * Changes the properties K from T to required | ||
| */ | ||
| export type PartiallyRequired<T, K extends keyof T> = DistributiveOmit<T, K> & { [P in K]-?: T[P] }; |
-89
| /** | ||
| * @mui/types v9.0.0-alpha.0 | ||
| * | ||
| * @license MIT | ||
| * This source code is licensed under the MIT license found in the | ||
| * LICENSE file in the root directory of this source tree. | ||
| */ | ||
| // disable automatic export | ||
| export {}; | ||
| /** | ||
| * `T extends ConsistentWith<T, U>` means that where `T` has overlapping properties with | ||
| * `U`, their value types do not conflict. | ||
| * | ||
| * @internal | ||
| */ | ||
| /** | ||
| * a function that takes {component} and returns a component that passes along | ||
| * all the props to {component} except the {InjectedProps} and will accept | ||
| * additional {AdditionalProps} | ||
| */ | ||
| /** | ||
| * Remove properties `K` from `T`. | ||
| * Distributive for union types. | ||
| * | ||
| * @internal | ||
| */ | ||
| /** | ||
| * Generate a set of string literal types with the given default record `T` and | ||
| * override record `U`. | ||
| * | ||
| * If the property value was `true`, the property key will be added to the | ||
| * string union. | ||
| * | ||
| * @internal | ||
| */ | ||
| /** | ||
| * Like `T & U`, but using the value types from `U` where their properties overlap. | ||
| * | ||
| * @internal | ||
| */ | ||
| // https://stackoverflow.com/questions/53807517/how-to-test-if-two-types-are-exactly-the-same | ||
| /** | ||
| * Issues a type error if `Expected` is not identical to `Actual`. | ||
| * | ||
| * `Expected` should be declared when invoking `expectType`. | ||
| * `Actual` should almost always we be a `typeof value` statement. | ||
| * | ||
| * @example `expectType<number | string, typeof value>(value)` | ||
| * TypeScript issues a type error since `value is not assignable to never`. | ||
| * This means `typeof value` is not identical to `number | string` | ||
| * @param actual | ||
| */ | ||
| /** | ||
| * A component whose root component can be controlled via a `component` prop. | ||
| * | ||
| * Adjusts valid props based on the type of `component`. | ||
| */ | ||
| /** | ||
| * Props of the component if `component={Component}` is used. | ||
| */ | ||
| // prettier-ignore | ||
| /** | ||
| * Props if `component={Component}` is NOT used. | ||
| */ | ||
| // prettier-ignore | ||
| /** | ||
| * Props defined on the component. | ||
| */ | ||
| // prettier-ignore | ||
| /** | ||
| * Simplifies the display of a type (without modifying it). | ||
| * Taken from https://effectivetypescript.com/2022/02/25/gentips-4-display/ | ||
| */ | ||
| /** | ||
| * Changes the properties K from T to required | ||
| */ |
| import * as React from 'react'; | ||
| declare module '@mui/types' { | ||
| /** | ||
| * A component whose root component can be controlled via a `component` prop. | ||
| * | ||
| * Adjusts valid props based on the type of `component`. | ||
| */ | ||
| interface OverridableComponent<M extends OverridableTypeMap> { | ||
| <C extends React.ElementType>(props: { | ||
| /** | ||
| * The component used for the root node. | ||
| * Either a string to use a HTML element or a component. | ||
| */ | ||
| component: C; | ||
| } & OverridePropsVer2<M, C>): React.JSX.Element; | ||
| (props: DefaultComponentPropsVer2<M>): React.JSX.Element; | ||
| propTypes?: any; | ||
| } | ||
| /** | ||
| * Props of the component if `component={Component}` is used. | ||
| */ | ||
| type OverridePropsVer2<M extends OverridableTypeMap, C extends React.ElementType> = (BaseProps<M> & DistributiveOmit<React.ComponentPropsWithoutRef<C>, keyof BaseProps<M>> & { | ||
| ref?: React.Ref<Element>; | ||
| }); | ||
| /** | ||
| * Props if `component={Component}` is NOT used. | ||
| */ | ||
| type DefaultComponentPropsVer2<M extends OverridableTypeMap> = BaseProps<M> & DistributiveOmit<React.ComponentPropsWithoutRef<M['defaultComponent']>, keyof BaseProps<M>> & { | ||
| ref?: React.Ref<Element>; | ||
| }; | ||
| } |
| export {}; |
| {"type":"module","sideEffects":false} |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
80379
3.4%12
-7.69%211
-36.83%1
Infinity%