diff --git a/CHANGELOG.md b/CHANGELOG.md index dab9963f9..c8e343f7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 5.15.2 / 4.15.2 + +- Fixes #2230 - computedvalue: throw error object instead of string when options is empty [#2243](https://github.com/mobxjs/mobx/pull/2243) + # 5.15.1 / 4.15.1 - Make initial values of observable set accept readonly array [#2202](https://github.com/mobxjs/mobx/pull/2202) diff --git a/src/core/computedvalue.ts b/src/core/computedvalue.ts index fd3e96bde..18795f182 100644 --- a/src/core/computedvalue.ts +++ b/src/core/computedvalue.ts @@ -105,8 +105,7 @@ export class ComputedValue implements IObservable, IComputedValue, IDeriva * This is useful for working with vectors, mouse coordinates etc. */ constructor(options: IComputedValueOptions) { - if (process.env.NODE_ENV !== "production" && !options.get) - throw "[mobx] missing option for computed: get" + invariant(options.get, "missing option for computed: get") this.derivation = options.get! this.name = options.name || "ComputedValue@" + getNextId() if (options.set) this.setter = createAction(this.name + "-setter", options.set) as any