From 3baf30cc2edd569205e99ec578d98a78b376d5d5 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Mon, 12 Mar 2018 09:43:57 +0100 Subject: [PATCH] Fixed accidental dependency on the `node` typings. Fixes #1387, #1362 --- .gitignore | 1 + CHANGELOG.md | 4 ++++ src/api/autorun.ts | 2 +- src/core/globalstate.ts | 2 +- src/utils/eq.ts | 6 +++--- src/utils/utils.ts | 6 +++--- tsconfig.json | 3 +-- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 915aafb5b..2d7c79c25 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ dist/ *.iml *.ipr *.iws +yarn-error.log diff --git a/CHANGELOG.md b/CHANGELOG.md index a7487b751..7e69e7198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ +# 3.6.2 + +* Fixed accidental dependency on the `node` typings. Fixes [#1387](https://github.com/mobxjs/mobx/issues/1387) / [#1362](https://github.com/mobxjs/mobx/issues/1387) + # 3.6.1 * Fixed [#1358](https://github.com/mobxjs/mobx/pull/1359): Deep comparison failing on IE11. By [le0nik](https://github.com/le0nik) through [#1359](https://github.com/mobxjs/mobx/pull/1359) diff --git a/src/api/autorun.ts b/src/api/autorun.ts index 8f646ba6c..87b246967 100644 --- a/src/api/autorun.ts +++ b/src/api/autorun.ts @@ -231,7 +231,7 @@ export function reaction( setTimeout(() => { isScheduled = false reactionRunner() - }, opts.delay) + }, opts.delay!) } }) diff --git a/src/core/globalstate.ts b/src/core/globalstate.ts index d74190e97..36fda2dff 100644 --- a/src/core/globalstate.ts +++ b/src/core/globalstate.ts @@ -105,7 +105,7 @@ let warnedAboutMultipleInstances = false "[mobx] Warning: there are multiple mobx instances active. This might lead to unexpected results. See https://github.com/mobxjs/mobx/issues/1082 for details." ) } - }) + }, 1) } } diff --git a/src/utils/eq.ts b/src/utils/eq.ts index 9445b783d..d0438d37d 100644 --- a/src/utils/eq.ts +++ b/src/utils/eq.ts @@ -2,12 +2,14 @@ import { areBothNaN, isArrayLike, isES6Map, iteratorToArray } from "./utils" import { observable } from "../api/observable" import { isObservableArray, isObservableMap } from "../mobx" -// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 +declare var Symbol +const toString = Object.prototype.toString export function deepEqual(a, b): boolean { return eq(a, b) } +// Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 // Internal recursive comparison function for `isEqual`. function eq(a, b, aStack?, bStack?) { // Identical objects are equal. `0 === -0`, but they aren't identical. @@ -23,8 +25,6 @@ function eq(a, b, aStack?, bStack?) { return deepEq(a, b, aStack, bStack) } -const toString = Object.prototype.toString - // Internal recursive comparison function for `isEqual`. function deepEq(a, b, aStack?, bStack?) { // Unwrap any wrapped objects. diff --git a/src/utils/utils.ts b/src/utils/utils.ts index 1beafe597..a4e0f6e76 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,7 +1,8 @@ export const EMPTY_ARRAY = [] Object.freeze(EMPTY_ARRAY) -declare var global +declare var window, global, Symbol + export function getGlobal() { return typeof window !== "undefined" ? window : global } @@ -182,8 +183,6 @@ export function iteratorToArray(it: Iterator): ReadonlyArray { return res } -declare var Symbol - export function primitiveSymbol() { return (typeof Symbol === "function" && Symbol.toPrimitive) || "@@toPrimitive" } @@ -196,3 +195,4 @@ import { globalState } from "../core/globalstate" import { IObservableArray, isObservableArray } from "../types/observablearray" import { isObservableMap, ObservableMap, IKeyValueMap } from "../types/observablemap" import { observable } from "../api/observable" +import { Iterator } from "./iterable" diff --git a/tsconfig.json b/tsconfig.json index 3d4f2cc45..cf4b5c3ce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,8 +13,7 @@ "noImplicitAny": false, "moduleResolution": "node", "lib": [ - "es5", - "dom" + "es5" ] }, "include": [