@@ -342,19 +342,20 @@ moduleFor(
342342 class extends RenderingTestCase {
343343 async '@test Can render a private field value' ( ) {
344344 await this . renderComponentModule ( ( ) => {
345- return class extends GlimmerishComponent {
345+ class TestComponent extends GlimmerishComponent {
346346 // eslint-disable-next-line no-unused-private-class-members
347347 #greeting = 'Hello, world!' ;
348348
349349 static {
350350 template ( '<p>{{this.#greeting}}</p>' , {
351351 component : this ,
352- scope : ( instance : any ) => ( {
353- '#greeting' : instance ? . #greeting,
352+ scope : ( instance ) => ( {
353+ '#greeting' : instance ? instance . #greeting : undefined ,
354354 } ) ,
355355 } ) ;
356356 }
357- } ;
357+ }
358+ return TestComponent ;
358359 } ) ;
359360
360361 this . assertHTML ( '<p>Hello, world!</p>' ) ;
@@ -363,7 +364,7 @@ moduleFor(
363364
364365 async '@test Can render multiple private fields' ( ) {
365366 await this . renderComponentModule ( ( ) => {
366- return class extends GlimmerishComponent {
367+ class TestComponent extends GlimmerishComponent {
367368 // eslint-disable-next-line no-unused-private-class-members
368369 #firstName = 'Jane' ;
369370 // eslint-disable-next-line no-unused-private-class-members
@@ -372,13 +373,14 @@ moduleFor(
372373 static {
373374 template ( '<p>{{this.#firstName}} {{this.#lastName}}</p>' , {
374375 component : this ,
375- scope : ( instance : any ) => ( {
376- '#firstName' : instance ? . #firstName,
377- '#lastName' : instance ? . #lastName,
376+ scope : ( instance ?: InstanceType < typeof TestComponent > ) => ( {
377+ '#firstName' : instance ? instance . #firstName : undefined ,
378+ '#lastName' : instance ? instance . #lastName : undefined ,
378379 } ) ,
379380 } ) ;
380381 }
381- } ;
382+ }
383+ return TestComponent ;
382384 } ) ;
383385
384386 this . assertHTML ( '<p>Jane Doe</p>' ) ;
@@ -387,7 +389,7 @@ moduleFor(
387389
388390 async '@test Can use private field method with on modifier' ( ) {
389391 await this . renderComponentModule ( ( ) => {
390- return class extends GlimmerishComponent {
392+ class TestComponent extends GlimmerishComponent {
391393 // eslint-disable-next-line no-unused-private-class-members
392394 #message = 'Hello' ;
393395
@@ -399,13 +401,14 @@ moduleFor(
399401 static {
400402 template ( '<button type="button" {{on "click" this.#updateMessage}}>Click</button>' , {
401403 component : this ,
402- scope : ( instance : any ) => ( {
404+ scope : ( instance ?: InstanceType < typeof TestComponent > ) => ( {
403405 on,
404- '#updateMessage' : instance ? . #updateMessage,
406+ '#updateMessage' : instance ? instance . #updateMessage : undefined ,
405407 } ) ,
406408 } ) ;
407409 }
408- } ;
410+ }
411+ return TestComponent ;
409412 } ) ;
410413
411414 this . assertHTML ( '<button type="button">Click</button>' ) ;
@@ -416,20 +419,21 @@ moduleFor(
416419 await this . renderComponentModule ( ( ) => {
417420 let Greeting = template ( '<span>{{yield}}</span>' ) ;
418421
419- return class extends GlimmerishComponent {
422+ class TestComponent extends GlimmerishComponent {
420423 // eslint-disable-next-line no-unused-private-class-members
421424 #name = 'Ember' ;
422425
423426 static {
424427 template ( '<Greeting>Hello, {{this.#name}}!</Greeting>' , {
425428 component : this ,
426- scope : ( instance : any ) => ( {
429+ scope : ( instance ?: InstanceType < typeof TestComponent > ) => ( {
427430 Greeting,
428- '#name' : instance ? . #name,
431+ '#name' : instance ? instance . #name : undefined ,
429432 } ) ,
430433 } ) ;
431434 }
432- } ;
435+ }
436+ return TestComponent ;
433437 } ) ;
434438
435439 this . assertHTML ( '<span>Hello, Ember!</span>' ) ;
@@ -444,7 +448,7 @@ moduleFor(
444448 assert . equal ( value , 42 ) ;
445449 } ;
446450
447- return class extends GlimmerishComponent {
451+ class TestComponent extends GlimmerishComponent {
448452 // eslint-disable-next-line no-unused-private-class-members
449453 #secretValue = 42 ;
450454
@@ -453,16 +457,17 @@ moduleFor(
453457 '<button {{on "click" (fn checkValue this.#secretValue)}}>Click</button>' ,
454458 {
455459 component : this ,
456- scope : ( instance : any ) => ( {
460+ scope : ( instance ?: InstanceType < typeof TestComponent > ) => ( {
457461 on,
458462 fn,
459463 checkValue,
460- '#secretValue' : instance ? . #secretValue,
464+ '#secretValue' : instance ? instance . #secretValue : undefined ,
461465 } ) ,
462466 }
463467 ) ;
464468 }
465- } ;
469+ }
470+ return TestComponent ;
466471 } ) ;
467472
468473 this . click ( 'button' ) ;
0 commit comments