Documentation: Recommended return type of synchronous hasMany relationships is wrong #1449
Labels
docs
types:core:data
Something is wrong with the Ember Data type definitions
types:core
Something is wrong with the Ember type definitions
According to ember-cli-typescript's ember-data Model documentation, the type of synchronous has many relationships is
EmberArray<T extends Model>
:This is incorrect. According to Ember 3.28's documentation:
This makes sense because it would mean that async relationships return a type of
PromiseManyArray<Model>
, while sync relationships returnManyArray<Model>
. Ember-cli-typescript's types forDS
even define this:I've updated my typings of sync relationships to
MutableArray<Model>
instead ofEmberArray<Model>
, asManyArray
extendsMutableArray
and I don't want to importDS
. Is this the correct approach? My recommendation would be to update the documentation to reflect this approach.Small code example to drive my point home:
With
EmberArray<Process>
,addObject
has a type error:However, the code does work if typechecking is disabled, and there are no type errors when using
processes: MutableArray<Process>
from@ember/array/mutable
.The text was updated successfully, but these errors were encountered: