Merge pull request #4254 from fredericlb/master

jsnox using react 0.13
This commit is contained in:
Masahiro Wakame
2015-05-08 20:50:10 +09:00
2 changed files with 11 additions and 9 deletions
+5 -5
View File
@@ -9,8 +9,8 @@ interface PersonProps {
age: number
}
var Person = React.createClass<PersonProps>({
render(): React.ReactHTMLElement { return null }
var Person = React.createClass<PersonProps, {}>({
render():React.ReactElement<any> { return null; }
});
var PersonTag = React.createFactory(Person);
@@ -19,7 +19,7 @@ var clickHandler: React.MouseEventHandler
// Tests with spec string
function spec_string () {
var result: React.ReactHTMLElement
var result: React.HTMLComponent
// just spec string
result = $('div')
@@ -38,7 +38,7 @@ function spec_string () {
// Tests with react component
function react_component() {
var result: React.ReactHTMLElement
var result: React.ReactElement<{}>
// with nothing more
result = $(Person)
@@ -54,4 +54,4 @@ function react_component() {
result = $(Person, props, 'hello') // one string child
result = $(Person, props, $('span', 'world')) // one element child
result = $(Person, props, ['hello', PersonTag()]) // mixed array of children
}
}
+6 -4
View File
@@ -1,12 +1,14 @@
// Type definitions for JSnoX
// Type definitions for JSnoX
// Project: https://github.com/af/jsnox
// Definitions by: Steve Baker <https://github.com/stkb/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../react/legacy/react-0.12.d.ts" />
/// <reference path="../react/react.d.ts" />
declare module 'jsnox' {
import React = require("react");
/*
* JSnoX requires an object with a createElement method.
* This will normally be the React object but could be something else
@@ -29,7 +31,7 @@ declare module 'jsnox' {
* @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.
*/
(specString: string, children: React.ReactNode): React.ReactHTMLElement
(specString: string, children: React.ReactNode): React.HTMLComponent
/**
* Renders an HTML element from the given spec string, with optional props
@@ -40,7 +42,7 @@ declare module 'jsnox' {
* @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.
*/
(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.ReactHTMLElement
(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.HTMLComponent
/**