Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript types? #9

Open
trejster opened this issue Sep 9, 2018 · 4 comments
Open

Typescript types? #9

trejster opened this issue Sep 9, 2018 · 4 comments

Comments

@trejster
Copy link

trejster commented Sep 9, 2018

Any idea where I can get hold of typescript types for this please?

@ackvf
Copy link

ackvf commented Feb 22, 2019

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

@devinus
Copy link

devinus commented Sep 27, 2019

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>;
}

@saiichihashimoto
Copy link

I'd like to revive this, considering that the core packages have types.

@saiichihashimoto
Copy link

I'm starting here DefinitelyTyped/DefinitelyTyped#51524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants