react-redux-typescript
Advanced tools
Comparing version 2.2.0 to 2.2.1
import { EmptyAction, PayloadAction } from './types'; | ||
/** | ||
* @export Action Creator helper factory function | ||
* @class ActionCreator | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
*/ | ||
export declare class ActionCreator<T, P> { | ||
readonly type: T; | ||
readonly payload: P; | ||
constructor(type: T); | ||
create: (payload: P) => { | ||
type: T; | ||
payload: P; | ||
}; | ||
} | ||
/** | ||
* @export createEmptyAction - empty action creator function | ||
* @template T - Type | ||
* @template T - Generic Type | ||
* @param type: T | ||
@@ -11,4 +26,4 @@ * @returns () => EmptyAction<T> | ||
* @export createPayloadAction - FSA action creator function | ||
* @template T - Type | ||
* @template P - Payload | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
* @param type: T | ||
@@ -15,0 +30,0 @@ * @returns (payload: P) => PayloadAction<T, P> |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* @export Action Creator helper factory function | ||
* @class ActionCreator | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
*/ | ||
var ActionCreator = (function () { | ||
function ActionCreator(type) { | ||
var _this = this; | ||
this.create = function (payload) { return ({ type: _this.type, payload: payload }); }; | ||
this.type = type; | ||
} | ||
return ActionCreator; | ||
}()); | ||
exports.ActionCreator = ActionCreator; | ||
/** | ||
* @export createEmptyAction - empty action creator function | ||
* @template T - Type | ||
* @template T - Generic Type | ||
* @param type: T | ||
@@ -16,4 +31,4 @@ * @returns () => EmptyAction<T> | ||
* @export createPayloadAction - FSA action creator function | ||
* @template T - Type | ||
* @template P - Payload | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
* @param type: T | ||
@@ -20,0 +35,0 @@ * @returns (payload: P) => PayloadAction<T, P> |
/** | ||
* @export returntypeof - extract return type of "expression" | ||
* workaround until added support in TS | ||
* https://github.com/Microsoft/TypeScript/issues/6606 | ||
* @template RT - ReturnType | ||
* @export returntypeof() - extract return type of an "expression" | ||
* @template RT - Generic Type | ||
* @param expression: (...params: any[]) => RT | ||
@@ -7,0 +5,0 @@ * @returns RT |
@@ -5,6 +5,4 @@ // Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io) | ||
/** | ||
* @export returntypeof - extract return type of "expression" | ||
* workaround until added support in TS | ||
* https://github.com/Microsoft/TypeScript/issues/6606 | ||
* @template RT - ReturnType | ||
* @export returntypeof() - extract return type of an "expression" | ||
* @template RT - Generic Type | ||
* @param expression: (...params: any[]) => RT | ||
@@ -11,0 +9,0 @@ * @returns RT |
/** | ||
* @type EmptyAction - Empty Action Type | ||
* @template T - Type | ||
* @template T - Generic Type | ||
*/ | ||
@@ -10,4 +10,4 @@ export declare type EmptyAction<T> = { | ||
* @type PayloadAction - Flux Standard Action Type | ||
* @template T - Type | ||
* @template P - Payload | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
*/ | ||
@@ -14,0 +14,0 @@ export declare type PayloadAction<T, P> = { |
import { EmptyAction, PayloadAction } from './types'; | ||
/** | ||
* @export Action Creator helper factory function | ||
* @class ActionCreator | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
*/ | ||
export declare class ActionCreator<T, P> { | ||
readonly type: T; | ||
readonly payload: P; | ||
constructor(type: T); | ||
create: (payload: P) => { | ||
type: T; | ||
payload: P; | ||
}; | ||
} | ||
/** | ||
* @export createEmptyAction - empty action creator function | ||
* @template T - Type | ||
* @template T - Generic Type | ||
* @param type: T | ||
@@ -11,4 +26,4 @@ * @returns () => EmptyAction<T> | ||
* @export createPayloadAction - FSA action creator function | ||
* @template T - Type | ||
* @template P - Payload | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
* @param type: T | ||
@@ -15,0 +30,0 @@ * @returns (payload: P) => PayloadAction<T, P> |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* @export Action Creator helper factory function | ||
* @class ActionCreator | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
*/ | ||
class ActionCreator { | ||
constructor(type) { | ||
this.create = (payload) => ({ type: this.type, payload }); | ||
this.type = type; | ||
} | ||
} | ||
exports.ActionCreator = ActionCreator; | ||
/** | ||
* @export createEmptyAction - empty action creator function | ||
* @template T - Type | ||
* @template T - Generic Type | ||
* @param type: T | ||
@@ -16,4 +29,4 @@ * @returns () => EmptyAction<T> | ||
* @export createPayloadAction - FSA action creator function | ||
* @template T - Type | ||
* @template P - Payload | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
* @param type: T | ||
@@ -20,0 +33,0 @@ * @returns (payload: P) => PayloadAction<T, P> |
/** | ||
* @export returntypeof - extract return type of "expression" | ||
* workaround until added support in TS | ||
* https://github.com/Microsoft/TypeScript/issues/6606 | ||
* @template RT - ReturnType | ||
* @export returntypeof() - extract return type of an "expression" | ||
* @template RT - Generic Type | ||
* @param expression: (...params: any[]) => RT | ||
@@ -7,0 +5,0 @@ * @returns RT |
@@ -5,6 +5,4 @@ // Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io) | ||
/** | ||
* @export returntypeof - extract return type of "expression" | ||
* workaround until added support in TS | ||
* https://github.com/Microsoft/TypeScript/issues/6606 | ||
* @template RT - ReturnType | ||
* @export returntypeof() - extract return type of an "expression" | ||
* @template RT - Generic Type | ||
* @param expression: (...params: any[]) => RT | ||
@@ -11,0 +9,0 @@ * @returns RT |
/** | ||
* @type EmptyAction - Empty Action Type | ||
* @template T - Type | ||
* @template T - Generic Type | ||
*/ | ||
@@ -10,4 +10,4 @@ export declare type EmptyAction<T> = { | ||
* @type PayloadAction - Flux Standard Action Type | ||
* @template T - Type | ||
* @template P - Payload | ||
* @template T - Generic Type | ||
* @template P - Generic Type | ||
*/ | ||
@@ -14,0 +14,0 @@ export declare type PayloadAction<T, P> = { |
{ | ||
"name": "react-redux-typescript", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "React / Redux / TypeScript Utils", | ||
@@ -17,11 +17,12 @@ "author": "Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)", | ||
"scripts": { | ||
"prepublishOnly": "yarn run reinstall && yarn run check && yarn run test && yarn run build", | ||
"clean": "rm -rf es5/ es6/ node_modules/", | ||
"reinstall": "rm -rf node_modules/ && yarn install", | ||
"build:es5": "rm -rf es5 && tsc -p src --outDir es5", | ||
"build:es6": "rm -rf es6 && tsc -p src --outDir es6 -t 'ES2015'", | ||
"build": "yarn run build:es5 & yarn run build:es6", | ||
"prepublishOnly": "yarn run clean && yarn install && yarn run check && yarn run test && yarn run build", | ||
"check": "yarn run lint & yarn run tsc", | ||
"lint": "tslint --project src/tsconfig.json", | ||
"tsc": "tsc -p src --noEmit", | ||
"test": "ts-node -P src src/specs/index.ts" | ||
"test": "ts-node -P src src/specs/index.ts", | ||
"build": "yarn run build:es5 & yarn run build:es6", | ||
"build:es5": "rm -rf es5/ && tsc -p src --outDir es5/", | ||
"build:es6": "rm -rf es6/ && tsc -p src --outDir es6/ -t 'ES2015'" | ||
}, | ||
@@ -28,0 +29,0 @@ "dependencies": {}, |
@@ -109,4 +109,2 @@ # React / Redux / TypeScript Utils | ||
export default connect(mapStateToProps, dispatchToProps)(CurrencyConverterContainer); | ||
// Props types inferred from mapStateToProps & dispatchToProps | ||
@@ -118,4 +116,8 @@ const stateProps = returntypeof(mapStateToProps); | ||
class CurrencyConverterContainer extends React.Component<Props, State> { | ||
... | ||
} | ||
export default connect(mapStateToProps, dispatchToProps)(CurrencyConverterContainer); | ||
``` | ||
Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16416
258
122