Skip to content

Commit

Permalink
Merge pull request #252 from schester44/feature/type-defs
Browse files Browse the repository at this point in the history
adds typescript type definitions
  • Loading branch information
mbrevda committed Nov 24, 2019
2 parents de1beea + 2914f1f commit 83c0e20
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -39,11 +39,13 @@
"*.md",
"es",
"umd",
"cjs"
"cjs",
"react-image.d.ts"
],
"module": "esm/index.js",
"main": "cjs/index.js",
"browser": "umd/index.js",
"types": "react-image.d.ts",
"author": "mbrevda@gmail.com",
"license": "MIT",
"bugs": {
Expand Down
31 changes: 31 additions & 0 deletions react-image.d.ts
@@ -0,0 +1,31 @@
declare module 'react-image' {
import * as React from 'react'

export interface ImgProps {
src?: string | string[]
loader?: JSX.Element
unloader?: JSX.Element
decode?: boolean
crossorigin?: string
container?: () => JSX.Element
loaderContainer?: () => JSX.Element
unloaderContainer?: () => JSX.Element

// For img element props such as 'alt'
[key: string]: any
}

export default class Img extends React.Component<ImgProps> {
constructor(props: ImgProps)
srcToArray(src: string): []
onLoad(): void
onError(): void
loadImg(): void
unloadImg(): void
componentDidMount(): void
componentWillUnmount(): void
componentWillReceiveProps(nextProps: ImgProps): void
render(): JSX.Element
}
}

0 comments on commit 83c0e20

Please sign in to comment.