Skip to content

Commit f2d637c

Browse files
committed
Merge pull request DefinitelyTyped#4254 from fredericlb/master
jsnox using react 0.13
2 parents fc7c4c4 + 829319d commit f2d637c

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

jsnox/jsnox-tests.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ interface PersonProps {
99
age: number
1010
}
1111

12-
var Person = React.createClass<PersonProps>({
13-
render(): React.ReactHTMLElement { return null }
12+
var Person = React.createClass<PersonProps, {}>({
13+
render():React.ReactElement<any> { return null; }
1414
});
1515

1616
var PersonTag = React.createFactory(Person);
@@ -19,7 +19,7 @@ var clickHandler: React.MouseEventHandler
1919

2020
// Tests with spec string
2121
function spec_string () {
22-
var result: React.ReactHTMLElement
22+
var result: React.HTMLComponent
2323

2424
// just spec string
2525
result = $('div')
@@ -38,7 +38,7 @@ function spec_string () {
3838

3939
// Tests with react component
4040
function react_component() {
41-
var result: React.ReactHTMLElement
41+
var result: React.ReactElement<{}>
4242

4343
// with nothing more
4444
result = $(Person)
@@ -54,4 +54,4 @@ function react_component() {
5454
result = $(Person, props, 'hello') // one string child
5555
result = $(Person, props, $('span', 'world')) // one element child
5656
result = $(Person, props, ['hello', PersonTag()]) // mixed array of children
57-
}
57+
}

jsnox/jsnox.d.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
// Type definitions for JSnoX
1+
// Type definitions for JSnoX
22
// Project: https://github.com/af/jsnox
33
// Definitions by: Steve Baker <https://github.com/stkb/>
44
// Definitions: https://github.com/borisyankov/DefinitelyTyped
55

6-
/// <reference path="../react/legacy/react-0.12.d.ts" />
6+
/// <reference path="../react/react.d.ts" />
77

88
declare module 'jsnox' {
99

10+
import React = require("react");
11+
1012
/*
1113
* JSnoX requires an object with a createElement method.
1214
* This will normally be the React object but could be something else
@@ -29,7 +31,7 @@ declare module 'jsnox' {
2931
* @param children A single React node (string or ReactElement) or array of nodes.
3032
* Note that unlike with React itself, multiple children must be placed into an array.
3133
*/
32-
(specString: string, children: React.ReactNode): React.ReactHTMLElement
34+
(specString: string, children: React.ReactNode): React.HTMLComponent
3335

3436
/**
3537
* Renders an HTML element from the given spec string, with optional props
@@ -40,7 +42,7 @@ declare module 'jsnox' {
4042
* @param children A single React node (string or ReactElement) or array of nodes.
4143
* Note that unlike with React itself, multiple children must be placed into an array.
4244
*/
43-
(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.ReactHTMLElement
45+
(specString: string, props?: React.HTMLAttributes, children?: React.ReactNode): React.HTMLComponent
4446

4547

4648
/**

0 commit comments

Comments
 (0)