Skip to content

Commit

Permalink
Keep type unions inside types.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Apr 8, 2022
1 parent 107011a commit 53b7e08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/components/src/input-control/input-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
LabelWrapper,
} from './styles/input-control-styles';
import type { InputBaseProps, LabelPosition } from './types';
import type { FlexProps } from '../flex/types';

function useUniqueId( idProp?: string ) {
const instanceId = useInstanceId( InputBase );
Expand Down Expand Up @@ -66,7 +65,7 @@ export function InputBase(
size = 'default',
suffix,
...props
}: InputBaseProps & FlexProps,
}: InputBaseProps,
ref: ForwardedRef< HTMLDivElement >
) {
const id = useUniqueId( idProp );
Expand Down
5 changes: 3 additions & 2 deletions packages/components/src/input-control/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { useDrag } from '@use-gesture/react';
*/
import type { StateReducer } from './reducer/state';
import type { WordPressComponentProps } from '../ui/context';
import type { FlexProps } from '../flex/types';

export type LabelPosition = 'top' | 'bottom' | 'side' | 'edge';

Expand Down Expand Up @@ -105,7 +106,7 @@ export interface InputFieldProps extends BaseProps {
type?: HTMLInputTypeAttribute;
}

export interface InputBaseProps extends BaseProps {
export interface InputBaseProps extends BaseProps, FlexProps {
children: ReactNode;
/**
* Renders an element on the left side of the input.
Expand All @@ -130,7 +131,7 @@ export interface InputBaseProps extends BaseProps {
}

export interface InputControlProps
extends Omit< InputBaseProps, 'children' | 'isFocused' >,
extends Omit< InputBaseProps, 'children' | 'isFocused' | keyof FlexProps >,
/**
* The `prefix` prop in `WordPressComponentProps< InputFieldProps, 'input', false >` comes from the
* `HTMLInputAttributes` and clashes with the one from `InputBaseProps`. So we have to omit it from
Expand Down

0 comments on commit 53b7e08

Please sign in to comment.