Files
DefinitelyTyped/jsnox/index.d.ts
Eric Anderson 9b53298395 Support Pick<> on setState now that TS 2.1 is out (#13155)
* Support Partial<> on setState now that TS 2.1 is out

* Update readme to reflect setState being typed correctly

* Switch setState to Pick

* Restore cloneELement portion of readme

* Use Pick<> | S for setState due to cast issue

* state and props should be readonly

* Fix nit + document why we

* Add typescript compiler header

* Update to properly order headers

* Update readme to reflect 2.1.5 fixing stPick

* Update readme now that 2.1.5 is out

* All that depend on react now require 2.1

* Fix definition that fails due to readonly state
2017-01-23 12:36:53 -08:00

69 lines
2.9 KiB
TypeScript

// Type definitions for JSnoX
// Project: https://github.com/af/jsnox
// Definitions by: Steve Baker <https://github.com/stkb/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="react" />
import React = require("react");
/*
* JSnoX requires an object with a createElement method.
* This will normally be the React object but could be something else
*/
interface ReactLikeObject {
createElement<P>(type: React.ComponentClass<P> | string,
props: P, children: React.ReactNode): React.ReactElement<P>;
}
interface Module {
(reactObj: ReactLikeObject): CreateElement
}
interface CreateElement {
/**
* Renders an HTML element from the given spec string, with children but without
* extra props.
* @param specString A string that defines a component in a way that resembles
* CSS selectors. Eg. "input:email#foo.bar.baz[name=email][required]"
* @param children A single React node (string or ReactElement) or array of nodes.
* Note that unlike with React itself, multiple children must be placed into an array.
*/
<P>(specString: string, children: React.ReactNode): React.DOMElement<P, Element>
/**
* Renders an HTML element from the given spec string, with optional props
* and children
* @param specString A string that defines a component in a way that resembles
* CSS selectors. Eg. "input:email#foo.bar.baz[name=email][required]"
* @param props Object of html attribute key-value pairs
* @param children A single React node (string or ReactElement) or array of nodes.
* Note that unlike with React itself, multiple children must be placed into an array.
*/
<P>(specString: string, props?: React.HTMLAttributes<{}>, children?: React.ReactNode): React.DOMElement<P, Element>
/**
* Renders a React component, with children but no props
* @param component A plain React component (created from React.createClass()) or
* component factory (created from React.createFactory())
* @param children A single React node (string or ReactElement) or array of nodes.
* Note that unlike with React itself, multiple children must be placed into an array.
*/
<P>(component: React.ComponentClass<P>, children: React.ReactNode): React.ReactElement<P>
/**
* Renders a React component, with optional props and children
* @param component A plain React component (created from React.createClass()) or
* component factory (created from React.createFactory())
* @param props Props object to pass to the component
* @param children A single React node (string or ReactElement) or array of nodes.
* Note that unlike with React itself, multiple children must be placed into an array.
*/
<P>(component: React.ComponentClass<P>, props?: P, children?: React.ReactNode): React.ReactElement<P>
}
declare var exports: Module
export = exports