Skip to content

Commit e93949d

Browse files
author
Seth Davenport
committed
Code review change: split tassign into its own package.
[fixes angular-redux#216]
1 parent b8c6a98 commit e93949d

File tree

5 files changed

+6
-59
lines changed

5 files changed

+6
-59
lines changed

docs/strongly-typed-reducers.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Instead, we've provided a type-corrected immutable assignment function, `tassign
148148
that will catch this type of error:
149149

150150
```typescript
151-
import { tassign } from 'ng2-redux';
151+
import { tassign } from 'tassign';
152152

153153
export const barReducer: Reducer<IBar> = (state: IBar, action: Action<number | string>): IBar => {
154154
switch(action.type) {

examples/counter/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@
3232
"core-js": "^2.3.0",
3333
"ng2-redux": "^4.0.0-beta.7",
3434
"redux": "^3.5.0",
35-
"redux-logger": "^2.6.1",
3635
"redux-localstorage": "^0.4.0",
36+
"redux-logger": "^2.6.1",
3737
"reflect-metadata": "0.1.3",
3838
"rxjs": "5.0.0-beta.12",
39+
"tassign": "^1.0.0",
3940
"zone.js": "^0.6.21"
4041
},
4142
"devDependencies": {

examples/counter/store/search.reducer.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { tassign } from 'tassign';
12
import { SEARCH_ACTIONS } from '../actions/search.actions';
23

34
export interface ISearchState {
@@ -18,14 +19,14 @@ export function searchReducer(
1819

1920
switch (action.type) {
2021
case SEARCH_ACTIONS.SEARCH:
21-
return Object.assign({}, state, {
22+
return tassign(state, {
2223
onSearch: true,
2324
keyword: action.payload,
2425
total: state.total
2526
});
2627
case SEARCH_ACTIONS.SEARCH_RESULT:
2728
let total = action.payload.total;
28-
return Object.assign({}, state, {
29+
return tassign(state, {
2930
onSearch: state.onSearch,
3031
keyword: state.keyword,
3132
total

src/utils/tassign.spec.ts

-52
This file was deleted.

src/utils/tassign.ts

-3
This file was deleted.

0 commit comments

Comments
 (0)