Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix internal issues caught by TS 4.9
TS 4.9 understands the `in` operator and catches two issues for us which earlier versions did not: 1. We were checking `name in model` in `Route#serialize` without checking that `model` there is an object. Given that a route's model is *not* guaranteed to be an object, this was a runtime error waiting to happen. `'a' in 2` will produce `TypeError: 2 is not an Object.' 2. We were checking for `Symbol.iterator in Array` in an internal `iterate()` utility in the `@ember/debug/data-adapter` package. This check is *always* true when targeting ES6 or newer for arrays, which would *appear* to makie the `else` branch a no-op on all supported browsers. Unfortunately, at least some consumers of this API implement a narrower contract for iterables (presumably due to legacy needs to interop with IE11 in Ember < 4.x). In those cases, we really have an iterable, *not* an array.
- Loading branch information