From beccbdedb528231485e152daedfc948b86754cc0 Mon Sep 17 00:00:00 2001 From: Alexey Svetliakov Date: Tue, 5 Jul 2016 22:16:42 +0200 Subject: [PATCH 1/2] Improved radium type definition --- radium/radium.d.ts | 114 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 106 insertions(+), 8 deletions(-) diff --git a/radium/radium.d.ts b/radium/radium.d.ts index 438d07aee4..2e931c6e01 100644 --- a/radium/radium.d.ts +++ b/radium/radium.d.ts @@ -1,20 +1,118 @@ // Type definitions for radium 0.17.1 // Project: https://github.com/formidablelabs/radium -// Definitions by: Alex Gorbatchev , Philipp Holzer +// Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// declare module 'radium' { - import React = require('react'); + import * as React from 'react'; + + + namespace Radium { + interface StyleRules { + [index: string]: React.CSSProperties; + } + + /** + * Style component properties + */ + export interface StyleProps { + /** + * An object of CSS rules to render. Each key of the rules object is a CSS selector and the value is an object + * of styles. If rules is empty, the component will render nothing. + */ + rules: StyleRules; + /** + * A string that any included selectors in rules will be appended to. + * Use to scope styles in the component to a particular element. A good use case might be to generate a unique + * ID for a component to scope any styles to the particular component that owns the + + + ) + } +} + + +Radium.TestMode.enable(); diff --git a/radium/radium.d.ts b/radium/radium.d.ts index 2e931c6e01..1989156877 100644 --- a/radium/radium.d.ts +++ b/radium/radium.d.ts @@ -112,7 +112,7 @@ declare module 'radium' { } // @Radium decorator function Radium(component: TElement): TElement; - function Radium(config: Radium.RadiumConfig): (component?: TElement) => TElement; + function Radium(config: Radium.RadiumConfig): (component?: any) => any; export = Radium; }