At @DanielRosenwasser's request, I'm making a checklist of things that Ember needs (or would like) to make an ergonomic TypeScript story for our users.
I'm using notation that may or may not be the correct implementation answer, but should help explain what I'm getting at. I can go into more detail on any of the items if needed:
static create<T>(attrs: T): this & Tstatic extend<T>(extensions: T): typeof (this & T)this onto methods on an object literalextend, can be passed to instanceof and can be newed. It should be possible to build this construct dynamically using ES5 constructs and explain the result in terms of typed ES6 at the interface boundary.1
static create<T>(attrs: T): this & T
this is tracked by https://github.com/Microsoft/TypeScript/issues/5863
2
static extend<T>(extensions: T): typeof (this & T)
how is that different from: static extends<T>(extensionFactory: { new (): T }): {new (): this & T} assuming #5863 is available.
3 the ability for a function or method to impute a this onto methods on an object literal
this should be working today through contextual typings. for instance:
declare function doSomething(a: { init?(this: BaseObject) });
doSomething({
init() {
this // BaseObject
}
})
4 the ability to construct a "constructable" class that has both the static and instance side at once,
We have talked about allowing class expressions in type locations. do not think there is a conceptual issue to stop this from working. but i think this should be tracked by a separate issue.
I would expect, however, that you want this in conjunction with extending generic type parameters (tracked by https://github.com/Microsoft/TypeScript/issues/4890), is this correct?
@wycats, I am going to close this in favor if #5863, #5863 and #4890, as these are more specific. if there are issues that i have missed please let me know.
I'll refresh this issue with my sense of the current status later today.
@wycats Any updates? 😌
@crhayes most of the open issues were addressed in 2.2. We had some announcements at EmberConf about it 😄
@wycats The announcements were exciting, but I don't think most of us (at least in the places I've brought it up so far) know what the current state is. Were the things announced at EmberConf just stepping stones, or is everything ready already? Can we use TypeScript with Ember yet, and if so, how?
@wycats Thanks, I'll check out some of the conference content!
Haven't seen any updates here in a while and the OP doesn't reflect the current state of Ember requests as I understand them. Welcome to a new issue with updated status but closing this as part of ~spring~ summer cleanup.
Most helpful comment
@wycats Any updates? 😌