ember-cli-typescript
ember-cli-typescript copied to clipboard
Return type on many route events are void rather than allowing boolean for bubbling
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
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.
Hi @chriskrycho, any update on this?
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!)
Thanks for the update!
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!