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

Missing overloads for some computed property macros

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

Which package(s) does this problem pertain to?

  • [x] @types/ember__object

Ember, I think since 3.9 or something, accepts an intermediate argument for the computed property macros sort, filter, etc, which is an array of dependencies. Used like so:

  foo: sort('bar', ['[email protected]'], function(bar1, bar2) {
    return ...
  })

But translating this to use decorators:

  @sort('bar', ['[email protected]'], function(bar1, bar2) {
    return ...
  })
  foo;

Causes Expected 2 arguments, but got 3.. This is the type definition:

export function sort(
    itemsKey: string,
    sortDefinition: string | ((itemA: any, itemB: any) => number)
): ComputedProperty<any[]>;

boris-petrov avatar Oct 06 '19 20:10 boris-petrov

Interesting! Can you link to the docs with it? That'd be super helpful!

chriskrycho avatar Oct 09 '19 22:10 chriskrycho

@chriskrycho - do you mean this? Check out the additionalDependentKeys part.

boris-petrov avatar Oct 10 '19 10:10 boris-petrov

Thanks for the link! If you open a PR to DefinitelyTyped, we'll definitely get them merged. Otherwise, one of us will try to hit it Soon™.

chriskrycho avatar Oct 28 '19 21:10 chriskrycho

@chriskrycho - I'll probably leave that to you, thanks. :smiley: There is no hurry. :)

boris-petrov avatar Oct 29 '19 11:10 boris-petrov

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

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