diff --git a/jsnox/jsnox-tests.ts b/jsnox/jsnox-tests.ts index 4e990766b..e34d71b4a 100644 --- a/jsnox/jsnox-tests.ts +++ b/jsnox/jsnox-tests.ts @@ -9,8 +9,8 @@ interface PersonProps { age: number } -var Person = React.createClass({ - render(): React.ReactHTMLElement { return null } +var Person = React.createClass({ + render():React.ReactElement { 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 -} \ No newline at end of file +} diff --git a/jsnox/jsnox.d.ts b/jsnox/jsnox.d.ts index 72584563b..dfb59e280 100644 --- a/jsnox/jsnox.d.ts +++ b/jsnox/jsnox.d.ts @@ -1,12 +1,14 @@ -// Type definitions for JSnoX +// Type definitions for JSnoX // Project: https://github.com/af/jsnox // Definitions by: Steve Baker // Definitions: https://github.com/borisyankov/DefinitelyTyped -/// +/// 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 /**