mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-09 19:50:08 +00:00
Extract react-inlinesvg type declarations from MyCrypto UI
This commit is contained in:
38
types/react-inlinesvg/index.d.ts
vendored
Normal file
38
types/react-inlinesvg/index.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// Type definitions for react-inlinesvg 0.8.3
|
||||
// Project: https://github.com/gilbarbara/react-inlinesvg#readme
|
||||
// Definitions by: MyCrypto <https://github.com/MyCryptoHQ>
|
||||
// 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<Props>;
|
||||
export default InlineSVG;
|
||||
19
types/react-inlinesvg/react-inlinesvg-tests.tsx
Normal file
19
types/react-inlinesvg/react-inlinesvg-tests.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as React from "react";
|
||||
import SVG from 'react-inlinesvg';
|
||||
|
||||
function Loader() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function myOnLoadHandler(src: string | URL) {
|
||||
}
|
||||
|
||||
<SVG
|
||||
src="/path/to/myfile.svg"
|
||||
preloader={<Loader />}
|
||||
onLoad={(src) => {
|
||||
myOnLoadHandler(src);
|
||||
}}
|
||||
>
|
||||
<img src="/path/to/myfile.png" />
|
||||
</SVG>;
|
||||
24
types/react-inlinesvg/tsconfig.json
Normal file
24
types/react-inlinesvg/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/react-inlinesvg/tslint.json
Normal file
1
types/react-inlinesvg/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user