added an optional (react) style property to the react-fontawesome definition file. (#18807)

* added a React style property to the react-fontawesome definition file.

* made amendments to FontAwesomeProps as suggest by vincaslt, now successfully extend React.HTMLProps<FontAwesome>.
This commit is contained in:
Gavin Gregory
2017-08-14 14:56:59 -04:00
committed by Mohamed Hegazy
parent 5beea6b1a9
commit 21a7a8a0b7
2 changed files with 18 additions and 7 deletions

View File

@@ -1,8 +1,9 @@
// Type definitions for react-fontawesome 1.6
// Project: https://github.com/danawoodman/react-fontawesome
// Definitions by: Timur Rustamov <https://github.com/timurrustamov>,
// Definitions by: Timur Rustamov <https://github.com/timurrustamov>
// Anton Kandybo <https://github.com/dublicator>
// Vincas Stonys <https://github.com/vincaslt>
// Gavin Gregory <https://github.com/gavingregory>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -12,13 +13,12 @@ export = FontAwesome;
declare namespace FontAwesome {
type FontAwesomeSize = 'lg' | '2x' | '3x' | '4x' | '5x';
type FontAwesomeStack = "1x" | "2x";
type FontAwesomeFlip = "horizontal" | "vertical";
type FontAwesomeStack = '1x' | '2x';
type FontAwesomeFlip = 'horizontal' | 'vertical';
interface FontAwesomeProps {
type FontAwesomeProps = React.HTMLProps<FontAwesome> | {
ariaLabel?: string;
border?: boolean;
className?: string;
cssModule?: any;
fixedWidth?: boolean;
flip?: FontAwesomeFlip;
@@ -30,7 +30,7 @@ declare namespace FontAwesome {
spin?: boolean;
stack?: FontAwesomeStack;
tag?: string;
}
};
}
declare class FontAwesome extends React.Component<FontAwesome.FontAwesomeProps> {}

View File

@@ -2,7 +2,7 @@ import * as React from "react";
import * as ReactDOM from "react-dom";
import FontAwesome = require('react-fontawesome');
class TestComponent extends React.Component {
class BasicTestComponent extends React.Component {
render() {
return (
<FontAwesome
@@ -14,3 +14,14 @@ class TestComponent extends React.Component {
);
}
}
class CSSTestComponent extends React.Component {
render() {
return (
<FontAwesome
name="rocket"
style={{backgroundColor: 'red', color: 'blue'}}
/>
);
}
}