diff --git a/types/react-svg/index.d.ts b/types/react-svg/index.d.ts new file mode 100644 index 0000000000..31a4533f57 --- /dev/null +++ b/types/react-svg/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for react-svg 2.2 +// Project: https://github.com/atomic-app/react-svg +// Definitions by: Chen Junda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +declare class ReactSVG extends React.Component {} + +export = ReactSVG; + +declare namespace ReactSVG { + interface ReactSVGProps { + /** + * Path to the SVG. + */ + path: string; + /** + * Function to call after the SVG is injected. Receives the newly injected SVG DOM element as a parameter. Defaults to null. + */ + callback?: (dom: SVGSVGElement) => void; + /** + * Class name to be added to the SVG. Defaults to ''. + */ + className?: string; + /** + * Class name to be added to the wrapping div. Defaults to ''. + */ + wrapperClassName?: string; + /** + * Run any script blocks found in the SVG (always, once, or never). Defaults to never. + */ + evalScripts?: 'always' | 'once' | 'never'; + /** + * Inline styles to be added to the SVG. Defaults to {}. + */ + style?: any; + } +} diff --git a/types/react-svg/react-svg-tests.tsx b/types/react-svg/react-svg-tests.tsx new file mode 100644 index 0000000000..338698b036 --- /dev/null +++ b/types/react-svg/react-svg-tests.tsx @@ -0,0 +1,14 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import ReactSVG = require("react-svg"); + +const complete = {}} + className="class-name" + wrapperClassName="wrapper-class-name" + evalScripts="once" + style={{}} + />; + +const minimal = ; diff --git a/types/react-svg/tsconfig.json b/types/react-svg/tsconfig.json new file mode 100644 index 0000000000..43b8246d54 --- /dev/null +++ b/types/react-svg/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "jsx": "react", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-svg-tests.tsx" + ] +} diff --git a/types/react-svg/tslint.json b/types/react-svg/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-svg/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }