mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
Adds definitions for react-svg (#23905)
* adds definition for react-svg * changed typescript version to 2.6 * make it work with require * fixed lint error
This commit is contained in:
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for react-svg 2.2
|
||||
// Project: https://github.com/atomic-app/react-svg
|
||||
// Definitions by: Chen Junda <https://github.com/viccrubs>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
declare class ReactSVG extends React.Component<ReactSVG.ReactSVGProps> {}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import ReactSVG = require("react-svg");
|
||||
|
||||
const complete = <ReactSVG
|
||||
path={"atomic.svg"}
|
||||
callback={svg => {}}
|
||||
className="class-name"
|
||||
wrapperClassName="wrapper-class-name"
|
||||
evalScripts="once"
|
||||
style={{}}
|
||||
/>;
|
||||
|
||||
const minimal = <ReactSVG path={"test.svg"}/>;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user