diff --git a/types/react-imgpro/index.d.ts b/types/react-imgpro/index.d.ts new file mode 100644 index 0000000000..0f513e55cf --- /dev/null +++ b/types/react-imgpro/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for react-imgpro 1.3 +// Project: https://github.com/nitin42/react-imgpro +// Definitions by: Carlos Li +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from "react"; + +import ProcessImage = ReactImgpro.ProcessImage; +export default ProcessImage; + +declare namespace ReactImgpro { + type Mode = "neighbor" | "bilinear" | "bicubic" | "hermite" | "bezier"; + interface Shape { + width?: number; + height?: number; + mode?: Mode; + } + interface Size { + width: number; + height: number; + mode: + "horizontal_left" | + "horizontal_center" | + "horizontal_right" | + "vertical_top" | + "vertical_bottom" | + "vertical_middle"; + } + interface ProcessImageProps { + image: string; + resize?: Shape; + quality?: number; + greyscale?: boolean; + normalize?: boolean; + invert?: boolean; + opaque?: boolean; + sepia?: boolean; + dither565?: boolean; + scale?: boolean; + scaleToFitImage?: { + width: number; + height: number; + }; + flip?: { + horizontal?: boolean; + vertical?: boolean; + }; + rotate?: { + degree: number; + mode: Mode; + }; + brightness?: number; /* should be -1 to 1 */ + contrast?: number; /* should be -1 to 1 */ + fade?: number; /* should be 0 - 1 */ + opacity?: number; /* should be 0 - 1 */ + blur?: number; /* should be 0 - 100 */ + posterize?: number; /* should be 0 - 100 */ + cover?: Size; + contain?: Size; + colors?: { + lighten?: number; + brighten?: number; + darken?: number; + desaturate?: number; + saturate?: number; + greyscale?: number; + spin?: number; + mix?: { + color?: string; + amount?: number; + }, + tint?: number; + xor?: number; + shade?: number; + red?: number; + green?: number; + blue?: number; + }; + storage?: boolean; + disableWebWorker?: boolean; + disableRerender?: boolean; + customCdn?: string; + onProcessFinish: () => void; + } + + class ProcessImage extends React.Component {} +} diff --git a/types/react-imgpro/react-imgpro-tests.tsx b/types/react-imgpro/react-imgpro-tests.tsx new file mode 100644 index 0000000000..74fd1a3045 --- /dev/null +++ b/types/react-imgpro/react-imgpro-tests.tsx @@ -0,0 +1,25 @@ +import * as React from 'react'; +import ProcessImage from "react-imgpro"; + +class Test extends React.Component { + render() { + return ( + console.log("onProcessFinish")} + > +
+
+
+ + ); + } +} diff --git a/types/react-imgpro/tsconfig.json b/types/react-imgpro/tsconfig.json new file mode 100644 index 0000000000..e888d7e2c3 --- /dev/null +++ b/types/react-imgpro/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-imgpro-tests.tsx" + ] +} diff --git a/types/react-imgpro/tslint.json b/types/react-imgpro/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-imgpro/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}