ember-cli-typescript
ember-cli-typescript copied to clipboard
Add @types/ember__helper for `@ember/helper`
Which package(s) does this enhancement 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
- [ ] @types/ember__routing
- [ ] @types/ember__application
- [ ] @types/ember__test
- [ ] @types/ember__test-helpers
- [ ] @types/ember__service
- [ ] @types/ember-data
- [ ] @types/rsvp
- [x] Other
- [ ] I don't know
Please write a user story for this feature
In recent ember, @ember/helper is availble for import, including apis such as:
invokeHelpercapabilitiessetHelperManager
Additionally, with template-strict mode, these will be required (but are available today)
fnhasharrayifconcatget- etc?
Here is the current (to be updated docs): https://api.emberjs.com/ember/release/modules/@ember%2Fhelper List of what's also available: https://github.com/emberjs/rfcs/blob/master/text/0496-handlebars-strict-mode.md#keywords
Thanks for opening. As per the usual, if you can help land docs on the importable helpers, that'll be great (we always follow the "don't add things to DT that aren't documented" policy).
can do!
lol, look at me the liar :sweat_smile:
I believe (we should check) that this is fixed now! @dfreeman opened a PE with it a week or so ago.
I added the strict-mode helper imports, but the manager APIs are still missing if those are what you're after
if those are what you're after
they are what I'm after :tada: they're handy for resources.
atm, I have a lot of:
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { createCache, getValue } from '@glimmer/tracking/primitives/cache';
import { setOwner } from '@ember/application';
import { associateDestroyableChild, registerDestructor } from '@ember/destroyable';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { capabilities as helperCapabilities, setHelperManager } from '@ember/helper';
:sweat_smile:
@dfreeman
I can try a PR at the manager API stuff.
The main question I have, is what does the Cache API look like? does that have types? (because invokeHelper takes a Cache) -- how would we add types to glimmer/tracking? do we first need to make glimmer/tracking a real npm package?
The problem here is exactly that @glimmer/tracking is a real npm package, and it ships types already, but the package itself has no primitives/cache subpath—that only exists for Ember consumers via smoke and mirrors.
I think @chriskrycho has the best depth of knowledge on this particular problem space (he's been the one to map out a path forward for the same "what you see is not what you get" issue with @glimmer/component), but I don't know if he's had the bandwidth to give this much thought yet, and/or whether he will any time in the near future.
On the bright side, it looks like capabilities and setHelperManager are both fully documented, and we've got established patterns in DT for their component equivalents, so adding declarations for those should be relatively straightforward 🙂
Resolved by Ember shipping its own types. 🎉