ember-cli-typescript
ember-cli-typescript copied to clipboard
Enumerable.filterBy has a wrong return type
Which package(s) does this problem pertain to?
- [x] @types/ember__array
Enumerable.filterBy (and possibly all other methods that are marked to return NativeArray<T>) doesn't actually return a NativeArray but rather a native JavaScript array. It's as simple as typing:
import { A } from '@ember/array';
const result = A().filterBy('foobar').mapBy('foobar');
This type-checks fine but at runtime blows up because filterBy doesn't return something that has a mapBy method.
Thank you! I'll see if I can land a fix this week!
Resolved by publishing types from Ember itself. (It's also possible this got fixed incidentally on DT at some point!)