Open trejster opened 6 years ago
I tried to work around it in the meantime, since the whole react-final-form
is typed, but to no avail.
https://stackoverflow.com/questions/54833810/type-an-untyped-package-with-types-from-another-package
Here's what I've got:
declare module 'react-final-form-html5-validation' {
import { ComponentType } from 'react';
import { FieldProps } from 'react-final-form';
interface Props {
max?: number;
maxLength?: number;
min?: number;
minLength?: number;
pattern?: string;
required?: boolean;
step?: number;
}
type MessageValue = string | ((value: any, props: Props) => string);
interface Messages {
badInput?: MessageValue;
patternMismatch?: MessageValue;
rangeOverflow?: MessageValue;
rangeUnderflow?: MessageValue;
stepMismatch?: MessageValue;
tooLong?: MessageValue;
tooShort?: MessageValue;
typeMismatch?: MessageValue;
valueMissing?: MessageValue;
}
export type Html5ValidationFieldProps<FieldValue = any, T extends HTMLElement = any> = FieldProps<
FieldValue,
HTMLElement
> &
Messages;
export const Field: ComponentType<Html5ValidationFieldProps>;
}
I'd like to revive this, considering that the core packages have types.
I'm starting here https://github.com/DefinitelyTyped/DefinitelyTyped/pull/51524
Any idea where I can get hold of typescript types for this please?