diff --git a/types/react-image-fallback/index.d.ts b/types/react-image-fallback/index.d.ts new file mode 100644 index 0000000000..4fcf2c20cd --- /dev/null +++ b/types/react-image-fallback/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for react-image-fallback 8.0 +// Project: https://github.com/socialtables/react-image-fallback +// Definitions by: Ben Smith +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +export default class ReactImageFallback extends React.Component< + ReactImageFallbackProps & + React.DetailedHTMLProps< + React.ImgHTMLAttributes, + HTMLImageElement + >, + any + > { } + +export interface ReactImageFallbackProps { + src: string; + fallbackImage: string | React.ReactElement | string[] | Array>; + initialImage?: string | React.ReactElement; + onLoad?: (event: React.SyntheticEvent) => void; + onError?: (event: React.SyntheticEvent) => void; + initialTimeout?: number; +} diff --git a/types/react-image-fallback/react-image-fallback-tests.tsx b/types/react-image-fallback/react-image-fallback-tests.tsx new file mode 100644 index 0000000000..963c34b619 --- /dev/null +++ b/types/react-image-fallback/react-image-fallback-tests.tsx @@ -0,0 +1,39 @@ +import * as React from 'react'; +import ReactImageFallback, { ReactImageFallbackProps } from 'react-image-fallback'; + +class ReactImageFallbackSimple extends React.Component { + render() { + return ; + } +} + +class ReactImageFallbackWithOptionals extends React.Component { + onLoad(event: React.SyntheticEvent) { + } + + onError(event: React.SyntheticEvent) { + } + + render() { + return ; + } +} + +class ReactImageFallbackWithImageTagProps extends React.Component { + render() { + return ; + } +} diff --git a/types/react-image-fallback/tsconfig.json b/types/react-image-fallback/tsconfig.json new file mode 100644 index 0000000000..503d6a0c45 --- /dev/null +++ b/types/react-image-fallback/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-image-fallback-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-image-fallback/tslint.json b/types/react-image-fallback/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-image-fallback/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }