JakeHartnell / react-images-upload

React input file component with images preview
https://jakehartnell.github.io/react-images-upload/
MIT License
347 stars 154 forks source link

Typescript definitions not up to date on npm #165

Open florisdipt opened 4 years ago

florisdipt commented 4 years ago

I installed the package as suggested in the readme but im missing/mismatching some of the typings. When i do a manual paste all is well. however this is not convenient for other members in my team or deploying. https://github.com/JakeHartnell/react-images-upload/blob/master/src/component/index.d.ts Was last updated 2 months ago the NPM was last updated 3 months ago https://www.npmjs.com/package/react-images-upload/v/1.2.8 Please re release. Thank you for your time.

computrius commented 4 years ago

I had the same issue. It would be great if this was updated as without it, the ability to set default images (at least) is broken.

I worked around it, however, by creating a local types.lib.d.ts and pasting this:

declare module "react-images-upload" {
    interface Props {
        className?: string
        fileContainerStyle?: object
        onChange?: (files: File[], pictures: string[]) => void
        buttonClassName?: string
        buttonStyles?: object
        withPreview?: boolean
        accept?: string
        name?: string
        withIcon?: boolean
        buttonText?: string
        withLabel?: boolean
        label?: string
        labelStyles?: object
        labelClass?: string
        imgExtension?: string[]
        maxFileSize?: number
        fileSizeError?: string
        fileTypeError?: string
        errorClass?: string
        errorStyle?: object
        singleImage?: boolean
        style?: object
        defaultImages?: string[]
    }
    export default class ReactImageUploadComponent extends Component<Props> { }
}