diff --git a/packages/imask/src/masked/factory.ts b/packages/imask/src/masked/factory.ts index a92dc911..24617b3e 100644 --- a/packages/imask/src/masked/factory.ts +++ b/packages/imask/src/masked/factory.ts @@ -124,7 +124,7 @@ type UpdateStaticOpts = never ; -type UpdateAnyOpts = Record; +type AnyOpts = Record; export type UpdateInstanceOpts = @@ -136,7 +136,7 @@ type UpdateInstanceOpts = M extends MaskedRange ? MaskedRangeOptions : M extends MaskedEnum ? MaskedEnumOptions : M extends MaskedPattern ? MaskedPatternOptions : - UpdateAnyOpts + AnyOpts ; export @@ -149,7 +149,7 @@ type UpdateConstructorOpts = M extends { mask: typeof MaskedFunction } ? MaskedFunctionOptions : M extends { mask: typeof MaskedPattern } ? MaskedPatternOptions : M extends { mask: typeof MaskedDynamic } ? MaskedDynamicOptions : - UpdateAnyOpts + AnyOpts ; export @@ -170,7 +170,7 @@ type UpdateOpts = Partial< Opts extends FactoryStaticOpts ? UpdateStaticOpts : Opts extends FactoryInstanceOpts ? UpdateInstanceOpts : Opts extends FactoryConstructorOpts ? UpdateConstructorOpts : - UpdateAnyOpts + AnyOpts >; export diff --git a/packages/react-imask/src/mixin.ts b/packages/react-imask/src/mixin.ts index 2e5671cd..d903f33c 100644 --- a/packages/react-imask/src/mixin.ts +++ b/packages/react-imask/src/mixin.ts @@ -125,7 +125,12 @@ type NonMaskProps< export type ReactMixinComponent< MaskElement extends InputMaskElement, -> = React.ComponentType & { inputRef: React.Ref; }>; + Props extends IMaskInputProps, +> = React.ComponentType< + & ReactElementProps + & { inputRef: React.Ref } + & NonMaskProps +>; export type MaskPropsKeys = Exclude; @@ -152,11 +157,13 @@ type IMaskInputProps< > = ReactElementProps & IMaskMixinProps; +type AnyProps = Record; + export default function IMaskMixin< MaskElement extends InputMaskElement, - Props extends IMaskInputProps, ->(ComposedComponent: ReactMixinComponent) { + Props extends IMaskInputProps=AnyProps, +>(ComposedComponent: ReactMixinComponent) { const MaskedComponent = class extends React.Component { static displayName: string; static propTypes: typeof MASK_PROPS; @@ -285,8 +292,7 @@ function IMaskMixin< MaskedComponent.displayName = `IMask(${nestedComponentName})`; MaskedComponent.propTypes = MASK_PROPS; - return React.forwardRef< - React.ComponentType, - Props - >((props, ref) => React.createElement(MaskedComponent, { ...props, ref })); + return React.forwardRef, Props>( + (props, ref) => React.createElement(MaskedComponent, { ...props, ref }) + ); }