Open igo opened 5 years ago
Hey @igo,
This might help if you're looking for a TypeScript definition. This is what I've got if you need a starting point :)
You'll need to create a definition file called react-mailchimp-subscribe.d.ts
and include the following code in it
type Status = 'sending' | 'error' | 'success';
type FormData = {
[key: string]: string;
}
interface IProps {
url: string;
render: (props: { subscribe: (formData: FormData) => void, status: Status, message: string }) => React.ReactNode;
}
declare module 'react-mailchimp-subscribe' {
export default class MailchimpSubscribe extends React.Component<IProps> {};
}
Regarding the type definitions @Ritural provided, I'd like to add that in case of errors in the jsonp
request, the message
can also be an instance of Error.
Pull requests welcome :)
Please add TypeScript definitions or convert project to TypeScript