Skip to content

Commit

Permalink
Fix for mobxjs#971 - throw error when action is used with getter
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriiOstapchuk committed Apr 29, 2017
1 parent 08e5a4f commit 9877ae7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export function createClassPropertyDecorator(
}
return newDescriptor;
} else {
if (typeof descriptor.get === "function") {
throw new Error("[mobx] action is not expected to be used with getters");
}

// babel and typescript getter / setter props
if (!hasOwnProperty(target, "__mobxLazyInitializers")) {
addHiddenProp(target, "__mobxLazyInitializers",
Expand Down

0 comments on commit 9877ae7

Please sign in to comment.