diff --git a/react-redux/react-redux-tests.ts b/react-redux/react-redux-tests.tsx similarity index 53% rename from react-redux/react-redux-tests.ts rename to react-redux/react-redux-tests.tsx index 5de0be520..852c0822a 100644 --- a/react-redux/react-redux-tests.ts +++ b/react-redux/react-redux-tests.tsx @@ -1,8 +1,25 @@ /// /// +/// import { Component } from 'react'; -import { connect } from 'react-redux'; +import * as React from 'react'; +import { Store } from 'redux'; +import { connect, Provider } from 'react-redux'; + +class MyRootComponent extends Component { + +} +var store: Store; + +React.render( + + {() => } + , + document.body +); + + function mapStateToProps(state: any): any { return { @@ -18,10 +35,16 @@ function mapDispatchToProps(dispatch: any): any { } export class Counter extends Component { - } export default connect( mapStateToProps, mapDispatchToProps )(Counter); + +@connect(mapStateToProps) +export class Counter2 extends Component { +} + + + diff --git a/react-redux/react-redux.d.ts b/react-redux/react-redux.d.ts index 05ce9fcb0..1a6a5cba1 100644 --- a/react-redux/react-redux.d.ts +++ b/react-redux/react-redux.d.ts @@ -3,6 +3,26 @@ // Definitions by: Qubo // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module "react-redux" { - export function connect(...functions: Function[]): (t: T) => T; + import { Component } from 'react'; + + export interface ClassDecorator { + (target: TFunction): TFunction|void; + } + + export function connect(...functions: Function[]): ClassDecorator; + + export interface Store { + subscribe: Function; + dispatch: Function; + getState: Function; + } + + export interface Property { + store: Store; + } + + export class Provider extends Component { } }