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

Return type on many route events are void rather than allowing boolean for bubbling

Open baron1405 opened this issue 6 years ago • 4 comments
trafficstars

Which package(s) does this problem pertain to?

  • [ ] @types/ember
  • [ ] @types/ember__string
  • [ ] @types/ember__polyfills
  • [ ] @types/ember__object
  • [ ] @types/ember__utils
  • [ ] @types/ember__array
  • [ ] @types/ember__engine
  • [ ] @types/ember__debug
  • [ ] @types/ember__runloop
  • [ ] @types/ember__error
  • [ ] @types/ember__controller
  • [ ] @types/ember__component
  • [X] @types/ember__routing
  • [ ] @types/ember__application
  • [ ] @types/ember__test
  • [ ] @types/ember__service
  • [ ] @types/ember-data
  • [ ] @types/rsvp
  • [ ] @types/ember-test-helpers
  • [ ] @types/ember-testing-helpers
  • [ ] Other
  • [ ] I don't know

What are instructions we can follow to reproduce the issue?

Open the route.d.ts file

Reproduction Case

Many of the Ember Route event methods can return true to control event bubbling. However, the type declaration for them has void as the return type. For example:

    didTransition(): void;
    error(error: any, transition: Transition): void;
    loading(transition: Transition, route: Route): void;
    willTransition(transition: Transition): void;

Per the Ember Guides, each of these methods can return true to bubble the event.

Now about that bug. What did you expect to see?

I am rather new to TypeScript but I would have expected to see a return type something like boolean|undefined.

What happened instead?

The return type is void

baron1405 avatar Jun 22 '19 17:06 baron1405

Thank you so much for reporting this! I'll see if I can get a fix in for it, probably next week but maybe this week.

chriskrycho avatar Jun 25 '19 12:06 chriskrycho

Hi @chriskrycho, any update on this?

baron1405 avatar Jul 21 '19 17:07 baron1405

Still on my radar and I’ll likely get to it in the second week of August. (July had a few things I wasn’t expecting work-wise!)

chriskrycho avatar Jul 21 '19 21:07 chriskrycho

Thanks for the update!

baron1405 avatar Jul 21 '19 22:07 baron1405

Obviously August 2019 did not see me getting to this. However, I did over the course of 2022 and early 2023 get Ember publishing its own types, where being in sync with the source of truth happens for free, so this is now resolved!

chriskrycho avatar Sep 28 '23 22:09 chriskrycho