ember-cli-typescript icon indicating copy to clipboard operation
ember-cli-typescript copied to clipboard

MutableArray.setObjects does not have to accept EmberArray

Open boris-petrov opened this issue 7 years ago • 4 comments

Which package(s) does this problem pertain to?

  • [x] @types/ember__array

MutableArray.setObjects is defined as:

setObjects(objects: EmberArray<T>): this;

It works fine when passed a native array so the type definition could be loosened to:

setObjects(objects: T[]): this;

In the Ember docs it says it accepts an Ember Array but I think this can also be changed.

Or am I mistaken?

boris-petrov avatar Oct 22 '18 12:10 boris-petrov

👍

Here's the source. It can be loosened further to

setObjects(objects: ReadonlyArray<T>): this;

dwickern avatar Oct 22 '18 14:10 dwickern

This has since been fixed: it now takes Enumerable<T>, which correctly accepts native arrays as well.

chriskrycho avatar Mar 15 '19 13:03 chriskrycho

@chriskrycho - I think you're mistaken. The issue is about setObjects, not pushObjects, and it still accepts EmberArray. Please reopen the issue. :)

boris-petrov avatar Mar 17 '19 19:03 boris-petrov

Ah, you are correct, my apologies! (Thanks for reopening, @mike-north!)

chriskrycho avatar Mar 17 '19 20:03 chriskrycho

I believe this issue is no longer relevant with the new Ember preview types.

boris-petrov avatar Jan 03 '23 07:01 boris-petrov