machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
691 stars 155 forks source link

Perfrom helper in Typescript #530

Closed stevcooo closed 1 year ago

stevcooo commented 1 year ago

Hello to you all, I'm trying to migrate our project to Typescript in order to be able to enable Glint. In many of our handlebars components, we're using the perform helper. But now whenever I run the glint command I get a number of errors because pefrom is not recognized as a helper by Glint. Does somebody has stumbled on something similar? Is there any workaround or a PR that will migrate perform helper to TypeScript is the only solution?

backspace commented 1 year ago

I think the Typescript/Glint way is to on 'whatever' this.taskName.perform 🤔

stevcooo commented 1 year ago

I've resolved it by using @gavant/glint-template-types package.

import { PerformHelper } from '@gavant/glint-template-types/types/ember-concurrency/perform';
...
declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry {
  ....
  perform: typeof PerformHelper;
  ....
  }
}