diff --git a/types/react-inlinesvg/index.d.ts b/types/react-inlinesvg/index.d.ts new file mode 100644 index 0000000000..6af53676ba --- /dev/null +++ b/types/react-inlinesvg/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for react-inlinesvg 0.8.3 +// Project: https://github.com/gilbarbara/react-inlinesvg#readme +// Definitions by: MyCrypto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { ComponentType, ReactNode } from 'react'; + +export interface RequestError extends Error { + isHttpError: boolean; + status: number; +} + +export interface InlineSVGError extends Error { + name: 'InlineSVGError'; + isSupportedBrowser: boolean; + isConfigurationError: boolean; + isUnsupportedBrowserError: boolean; + message: string; +} + +export interface Props { + baseURL?: string; + cacheGetRequests?: boolean; + children?: ReactNode; + className?: string; + preloader?: ReactNode; + src: URL | string; + style?: object; + uniqueHash?: string; + uniquifyIDs?: boolean; + onError?(error: RequestError | InlineSVGError): void; + onLoad?(src: URL | string, isCached: boolean): void; + supportTest?(): void; + wrapper?(): ReactNode; +} + +declare const InlineSVG: ComponentType; +export default InlineSVG; diff --git a/types/react-inlinesvg/react-inlinesvg-tests.tsx b/types/react-inlinesvg/react-inlinesvg-tests.tsx new file mode 100644 index 0000000000..a7d90e0d86 --- /dev/null +++ b/types/react-inlinesvg/react-inlinesvg-tests.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import SVG from 'react-inlinesvg'; + +function Loader() { + return null; +} + +function myOnLoadHandler(src: string | URL) { +} + +} + onLoad={(src) => { + myOnLoadHandler(src); + }} +> + +; diff --git a/types/react-inlinesvg/tsconfig.json b/types/react-inlinesvg/tsconfig.json new file mode 100644 index 0000000000..d8efae284d --- /dev/null +++ b/types/react-inlinesvg/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-inlinesvg-tests.tsx" + ] +} diff --git a/types/react-inlinesvg/tslint.json b/types/react-inlinesvg/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-inlinesvg/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }