ember-cli / ember-page-title

Page title management for Ember.js Apps
https://ember-cli.github.io/ember-page-title/
Other
188 stars 57 forks source link

Convert to TS or supply ambient definitions #239

Closed chriskrycho closed 9 months ago

chriskrycho commented 2 years ago

As part of Ember.js RFC #0800, this package needs to supply type definitions. Preferably, this would happen by converting to TS and generating from the source; as an alternative, it can publish ambient types (presumably starting with the ones on DefinitelyTyped).

All the members of the Typed Ember team are happy to advise on how to do this; feel free to reach out in #dev-typescript on Discord if you have questions!

knownasilya commented 2 years ago

If converting to TS, is there a setup that people are using in embroider addons? Would love an example. cc @NullVoxPopuli

NullVoxPopuli commented 2 years ago

My* TS v2 addons:

knownasilya commented 2 years ago

Is there a consistent TS setup among them?

NullVoxPopuli commented 2 years ago

mostly, ya

leepfrog commented 1 year ago

I ran into the lack of page-title types when trying to use the new ember 5.1 ember-source types:

app/templates/application.hbs:1:3 - error TS7053: Unknown name 'page-title'. If this isn't a typo, you may be missing a registry entry for this value; see the Template Registry page in the Glint documentation for more details.
  Element implicitly has an 'any' type because expression of type '"page-title"' can't be used to index type 'Globals'.
    Property 'page-title' does not exist on type 'Globals'.

To fix, I added types to types/ember-page-title/index.d.ts:

import { HelperLike } from '@glint/template';

export type PageTitle = abstract new <T>() => InstanceType<
  HelperLike<{
    Args: {
      Positional: [value: T];
    };
    Return: '';
  }>
>;

declare module '@glint/environment-ember-loose/registry' {
  export default interface Registry {
    'page-title': PageTitle;
  }
}
knownasilya commented 1 year ago

@leepfrog any help in getting https://github.com/ember-cli/ember-page-title/pull/246 across the finish line is appreciated 👍🏼

leepfrog commented 1 year ago

@knownasilya opened up #256 that might help?

HeroicEric commented 9 months ago

@NullVoxPopuli This should be fixed by https://github.com/ember-cli/ember-page-title/pull/275 ?

NullVoxPopuli commented 9 months ago

yup! thanks!