typed-ember / ember-cli-typescript

Use TypeScript in your Ember.js apps!
https://docs.ember-cli-typescript.com
MIT License
363 stars 99 forks source link

Add type-information for the `cached` decorator #1482

Closed boris-petrov closed 1 year ago

boris-petrov commented 2 years ago

Which package(s) does this enhancement pertain to?

Please write a user story for this feature

import { cached } from '@glimmer/tracking'; leads to Module '"@glimmer/tracking"' has no exported member 'cached'.. As of Ember 4 the cached decorator is available by default.

I currently work-around that issue by adding:

declare module '@glimmer/tracking' {
  export const cached: PropertyDecorator;
}
chriskrycho commented 2 years ago

Thanks for writing this up, @boris-petrov. As per the usual flow, we need it documented in Ember itself, and then a PR to DefinitelyTyped will be very welcome and we'll merge it!

andreyfel commented 1 year ago

It is in the docs since Ember 4.5: https://api.emberjs.com/ember/4.5/functions/@glimmer%2Ftracking/cached

dfreeman commented 1 year ago

Just a note for posterity here, @glimmer/tracking's types aren't managed in DT—it ships its own declarations, and there's an issue over their noting the missing export: https://github.com/glimmerjs/glimmer.js/issues/408

boris-petrov commented 1 year ago

Thanks, @dfreeman! In that case, I guess this one can be closed! :)