Skip to content

Commit de10f00

Browse files
author
Sashko Stubailo
authored
Merge pull request #419 from apollostack/typescript-2.0
Update Typescript to 2.0
2 parents 378cbbe + 16f621b commit de10f00

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"license": "MIT",
3939
"dependencies": {
4040
"es6-promise": "^3.1.2",
41-
"graphql-tag": "^0.1.8",
41+
"graphql-tag": "^0.1.10",
4242
"lodash.assign": "^4.0.8",
4343
"lodash.clonedeep": "^4.3.2",
4444
"lodash.countby": "^4.4.0",
@@ -88,7 +88,7 @@
8888
"sinon": "^1.17.4",
8989
"source-map-support": "^0.4.0",
9090
"tslint": "3.13.0",
91-
"typescript": "^1.8.9",
91+
"typescript": "^2.0.0",
9292
"typings": "^1.0.0",
9393
"uglify-js": "^2.6.2"
9494
}

src/data/store.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ export function data(
5050
mutations: MutationStore,
5151
config: ApolloReducerConfig
5252
): NormalizedCache {
53+
// XXX This is hopefully a temporary binding to get around
54+
// https://github.com/Microsoft/TypeScript/issues/7719
55+
const constAction = action;
56+
5357
if (isQueryResultAction(action)) {
5458
if (!queries[action.queryId]) {
5559
return previousState;
@@ -81,16 +85,16 @@ export function data(
8185

8286
return newState;
8387
}
84-
} else if (isMutationResultAction(action)) {
88+
} else if (isMutationResultAction(constAction)) {
8589
// Incorporate the result from this mutation into the store
86-
if (!action.result.errors) {
87-
const queryStoreValue = mutations[action.mutationId];
90+
if (!constAction.result.errors) {
91+
const queryStoreValue = mutations[constAction.mutationId];
8892

8993
// XXX use immutablejs instead of cloning
9094
const clonedState = assign({}, previousState) as NormalizedCache;
9195

9296
let newState = writeSelectionSetToStore({
93-
result: action.result.data,
97+
result: constAction.result.data,
9498
dataId: queryStoreValue.mutation.id,
9599
selectionSet: queryStoreValue.mutation.selectionSet,
96100
variables: queryStoreValue.variables,
@@ -99,11 +103,11 @@ export function data(
99103
fragmentMap: queryStoreValue.fragmentMap,
100104
});
101105

102-
if (action.resultBehaviors) {
103-
action.resultBehaviors.forEach((behavior) => {
106+
if (constAction.resultBehaviors) {
107+
constAction.resultBehaviors.forEach((behavior) => {
104108
const args: MutationBehaviorReducerArgs = {
105109
behavior,
106-
result: action.result,
110+
result: constAction.result,
107111
variables: queryStoreValue.variables,
108112
fragmentMap: queryStoreValue.fragmentMap,
109113
selectionSet: queryStoreValue.mutation.selectionSet,

0 commit comments

Comments
 (0)