diff --git a/react-file-input/react-file-input-tests.tsx b/react-file-input/react-file-input-tests.tsx new file mode 100644 index 0000000000..208a8d29ed --- /dev/null +++ b/react-file-input/react-file-input-tests.tsx @@ -0,0 +1,27 @@ +/// +/// + +import * as React from "react"; +import FileInput = require('react-file-input'); + +class Form extends React.Component<{}, {}> { + handleChange = (event: React.SyntheticEvent) => { + const target: any = event.target; + console.log('Selected file:', target.files[0]); + } + + render(): React.ReactElement<{}> { + return ( +
+ + + ); + } +} diff --git a/react-file-input/react-file-input.d.ts b/react-file-input/react-file-input.d.ts new file mode 100644 index 0000000000..ca0cac594b --- /dev/null +++ b/react-file-input/react-file-input.d.ts @@ -0,0 +1,24 @@ +// Type definitions for react-file-input +// Project: https://www.npmjs.com/package/react-file-input +// Definitions by: Dmitry Rogozhny +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "react-file-input" { + import React = __React; + + interface FileInputProps { + name: string; + className: string; + accept: string; + placeholder: string; + disabled?: boolean; + onChange: (event: React.SyntheticEvent) => void; + } + + class FileInput extends React.Component { + } + + export = FileInput; +}