Skip to content

Instantly share code, notes, and snippets.

@zpao
Created July 29, 2015 01:34
Show Gist options
  • Save zpao/faa98f3b13a9a26cafaa to your computer and use it in GitHub Desktop.
Save zpao/faa98f3b13a9a26cafaa to your computer and use it in GitHub Desktop.
diff --git a/src/isomorphic/modern/class/React.d.ts b/src/isomorphic/modern/class/React.d.ts
index ff31760..25ec14a 100644
--- a/src/isomorphic/modern/class/React.d.ts
+++ b/src/isomorphic/modern/class/React.d.ts
@@ -26,6 +26,7 @@ declare module 'React' {
}
export var PropTypes : any;
export function createElement(tag : any, props ?: any, ...children : any[]) : any
+ export function createFactory(component : any) : any
export function render(element : any, container : any) : any
export function unmountComponentAtNode(container : any) : void
export function findDOMNode(instance : any) : any
diff --git a/src/isomorphic/modern/class/__tests__/ReactTypeScriptClass-test.ts b/src/isomorphic/modern/class/__tests__/ReactTypeScriptClass-test.ts
index 8b3745e..79bee86 100644
--- a/src/isomorphic/modern/class/__tests__/ReactTypeScriptClass-test.ts
+++ b/src/isomorphic/modern/class/__tests__/ReactTypeScriptClass-test.ts
@@ -330,6 +330,13 @@ describe('ReactTypeScriptClass', function() {
test(React.createElement(SimpleStateless, {bar: 'bar'}), 'DIV', 'bar');
});
+ it('works with createFactory', function() {
+ expect(function() {
+ var SimpleStatelessFactory = React.createFactory(SimpleStateless);
+ React.render(SimpleStatelessFactory(), container);
+ }).not.toThrow();
+ });
+
it('renders based on state using initial values in this.props', function() {
test(
React.createElement(InitialState, {initialValue: 'foo'}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment