Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions types/ember/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ declare module 'ember' {
*
* Generally you would use `EmberClass.create()` instead of `new EmberClass()`.
*
* The no-arg constructor is required by the typescript compiler.
* The single-arg constructor is required by the typescript compiler.
* The multi-arg constructor is included for better ergonomics.
*
* Implementation is carefully chosen for the reasons described in
* https://github.com/typed-ember/ember-typings/pull/29
*/
type EmberClassConstructor<T> = (new () => T) & (new (...args: any[]) => T);
type EmberClassConstructor<T> = (new (properties?: object) => T) & (new (...args: any[]) => T);

type ComputedPropertyGetterFunction<T> = (this: any, key: string) => T;

Expand Down Expand Up @@ -761,6 +761,12 @@ declare module 'ember' {
}
const Copyable: Ember.Mixin<Copyable>;
class CoreObject {
/**
* As of Ember 3.1, CoreObject constructor takes initial object properties as an argument.
* See: https://github.com/emberjs/ember.js/commit/4709935854d4c29b0d2c054614d53fa2c55309b1
**/
constructor(properties?: object);

_super(...args: any[]): any;

/**
Expand Down
12 changes: 12 additions & 0 deletions types/ember/test/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ const LifetimeHooks = Ember.Object.extend({
this._super();
}
});

class MyObject30 extends Ember.Object {
constructor() {
super();
}
}

class MyObject31 extends Ember.Object {
constructor(properties: object) {
super(properties);
}
}