Windvis / ember-breadcrumb-trail

Minimalistic but very flexible breadcrumb management solution for Ember applications.
MIT License
14 stars 3 forks source link

Add TypeScript types #28

Closed charlesfries closed 3 months ago

Windvis commented 9 months ago

CI faillures seem to be caused by the very outdated node 12 this repo is still using 😄. We'll just ignore those for now.

charlesfries commented 9 months ago

@Windvis I am nearly positive that just adding the *.d.ts files will make the types available to consuming applications (take a look at this PR for ember-data-model-fragments as an example of a JS addon shipping types: https://github.com/adopted-ember-addons/ember-data-model-fragments/pull/443)

Windvis commented 9 months ago

@Windvis I am nearly positive that just adding the *.d.ts files will make the types available to consuming applications (take a look at this PR for ember-data-model-fragments as an example of a JS addon shipping types: https://github.com/adopted-ember-addons/ember-data-model-fragments/pull/443)

But you still need to import that index.d.ts file in your app I assume? Something like import 'ember-breadcrumb-trail';? Or is that not how it works? You would also need to add the helpers to your glint registry manually, no? Since this only exposes the base types of the helper? Are the types in the current PR useful without Glint?

Sorry, many questions, but I don't use TS in apps yet, so I've little experience with it 😄.

Windvis commented 9 months ago

I think it might also be possible to expose types from a declarations folder and matching the addon folder structure so TS can find them without having to import an index file first. Something like: declarations/helpers/breadcrumb.d.ts maybe?

Anyway, I'll try to take a more detailed look at it soon. Thanks for the nudge!

Windvis commented 3 months ago

@charlesfries I've finally finished the TS conversion PR + released it as 1.0.0. Sorry for the delay :smile: