Add Ember.CoreObject constructor with initial properties arg (#24997)

This commit is contained in:
James C. Davis
2018-04-16 15:24:28 -07:00
committed by Ryan Cavanaugh
parent ed2cf925b3
commit a7f56fc5ce
2 changed files with 20 additions and 2 deletions
+8 -2
View File
@@ -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;
@@ -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;
/**
+12
View File
@@ -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);
}
}