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

Return value of `Store.query` is incorrect

Open lolmaus opened this issue 4 years ago • 1 comments

Which package(s) does this problem pertain to?

  • [x] @types/ember-data

Reproduction Case

const result = await store.query('products');

Now about that bug. What did you expect to see?

result.meta // => a `Record` with metadata

What happened instead?

TypeScript says that property meta does not exist.

Comment

meta exists exists in type ManyArray and, by inherence, PromiseManyArray.

But Store.query is typed to return PromiseArray that does not contain meta.

CC @chriskrycho @dfreeman @jamescdavis @mike-north @dwickern @catz

Issue migrated from https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/55562

lolmaus avatar Sep 03 '21 15:09 lolmaus

Thanks for opening this! @jamescdavis I believe you know Ember Data best of the current maintainers (and cc. also @runspired) – the docs say we ought to return a Promise of an AdapterPopulatedRecordArray at this point (which type simply did not exist when the current types were written!), and that does not have meta on it. What’s the right answer?

chriskrycho avatar Sep 03 '21 19:09 chriskrycho