mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 19:51:53 +00:00
Add definitions for reactcss (#12122)
* Add definitions for react-css-transition-replace * Add definitions for reactcss * Change test header * Remove accidentally added other definitions * Remove yarn.lock from .gitignore
This commit is contained in:
committed by
Masahiro Wakame
parent
47221120df
commit
b6bd0766d8
@@ -0,0 +1,29 @@
|
||||
// ReactCSS Test
|
||||
// ================================================================================
|
||||
///<reference path="reactcss.d.ts"/>
|
||||
///<reference path="../react/react.d.ts"/>
|
||||
///<reference path="../react/react-dom.d.ts"/>
|
||||
|
||||
// Imports
|
||||
// --------------------------------------------------------------------------------
|
||||
import * as React from "react"
|
||||
import { StatelessComponent } from "react"
|
||||
import { render } from "react-dom"
|
||||
import { default as reactCSS, hover, loop } from "reactcss"
|
||||
|
||||
interface TestProps extends ReactCSS.HoverProps {}
|
||||
|
||||
var styles: any = reactCSS({
|
||||
default : {},
|
||||
hover : {}
|
||||
}, { hover : true })
|
||||
|
||||
var loopProps: ReactCSS.LoopableProps = loop(1, 10)
|
||||
|
||||
var TestComponent: StatelessComponent<TestProps>
|
||||
var Test = hover(TestComponent)
|
||||
|
||||
render(
|
||||
<Test />,
|
||||
document.getElementById("main")
|
||||
)
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for ReactCSS v1.0.0
|
||||
// Project: http://reactcss.com/
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
declare namespace ReactCSS {
|
||||
interface LoopableProps {
|
||||
"first-child"?: boolean
|
||||
"last-child"?: boolean
|
||||
even?: boolean
|
||||
odd?: boolean
|
||||
[nthChild: string]: boolean
|
||||
}
|
||||
|
||||
interface HoverProps {
|
||||
hover?: boolean
|
||||
}
|
||||
|
||||
interface Classes {
|
||||
default: any
|
||||
[scope: string]: any
|
||||
}
|
||||
}
|
||||
|
||||
declare module "reactcss" {
|
||||
import React = __React
|
||||
|
||||
export type LoopableProps = ReactCSS.LoopableProps
|
||||
export function hover<A>(component: React.ComponentClass<A> | React.StatelessComponent<A>): React.ComponentClass<A>
|
||||
export function loop(i: number, length: number): ReactCSS.LoopableProps
|
||||
export default function reactCSS (classes: ReactCSS.Classes, ...activations: Array<any>): any
|
||||
}
|
||||
Reference in New Issue
Block a user