File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ class CoreObject {
346346 @method init
347347 @public
348348 */
349- init ( _properties : object | undefined ) { }
349+ init ( _properties ? : object ) { }
350350
351351 /**
352352 Defines the properties that will be concatenated from the superclass
Original file line number Diff line number Diff line change @@ -17,12 +17,14 @@ const component1 = Component.extend({
1717 } ,
1818} ) ;
1919
20- class AnotherComponent extends Component {
21- name = '' ;
22-
23- init ( ) {
20+ class ClassicComponent extends Component {
21+ override init ( ) : void {
2422 super . init ( ) ;
2523 }
24+ }
25+
26+ class AnotherComponent extends Component {
27+ name = '' ;
2628
2729 hello ( name : string ) {
2830 this . set ( 'name' , name ) ;
Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ expectTypeOf(co1.isDestroying).toBeBoolean();
99expectTypeOf ( co1 . destroy ( ) ) . toEqualTypeOf < CoreObject > ( ) ;
1010expectTypeOf ( co1 . toString ( ) ) . toBeString ( ) ;
1111
12+ /** Subclasses may override init and call super.init() without arguments. */
13+ class CoreObjectWithInit extends CoreObject {
14+ override init ( ) : void {
15+ super . init ( ) ;
16+ }
17+ }
18+
1219/** .create tests */
1320const co2 = CoreObject . create ( ) ;
1421expectTypeOf ( co2 . isDestroyed ) . toBeBoolean ( ) ;
You can’t perform that action at this time.
0 commit comments