diff --git a/src/types.ts b/src/types.ts index a56a291d..b410c6b1 100644 --- a/src/types.ts +++ b/src/types.ts @@ -492,14 +492,18 @@ export type IntrospectedInputGuesserProps = Partial & 'filter' | 'page' | 'perPage' | 'sort' | 'enableGetChoices' >; -export type InputGuesserProps = Omit< +// Thanks Tkdodo! +// https://tkdodo.eu/blog/omit-for-discriminated-unions-in-type-script#distributive-omit +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export type DistributiveOmit = T extends any + ? Omit + : never; + +export type InputGuesserProps = DistributiveOmit< InputProps & Omit, 'component' > & { transformEnum?: (value: string | number) => string | number; - // due to the union type some TextInputProps don't surface in the final type, re-adding them here - multiline?: boolean; - readOnly?: boolean; } & Pick< ReferenceInputProps | ReferenceArrayInputProps, 'filter' | 'page' | 'perPage' | 'sort' | 'enableGetChoices'