File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
modules/35-interfaces/20-interface-using Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,4 @@ const superMan: ISuperman = {
2424} ;
2525// END
2626
27- export default superMan ;
27+ export { superMan , ISuperman , IBird , IPlane } ;
Original file line number Diff line number Diff line change 1- import { expect , test } from 'vitest'
2- import superMan from './index' ;
1+ import { expect , test , expectTypeOf } from 'vitest'
2+ import { superMan , ISuperman , IBird , IPlane } from './index' ;
33
44test ( 'guess who' , ( ) => {
55 expect ( superMan . guessWho ( 'bird' ) ) . toBe ( "It's a bird?" ) ;
66 expect ( superMan . guessWho ( 'plane' ) ) . toBe ( "It's a plane?" ) ;
77 expect ( superMan . guessWho ( 'SupErMan' ) ) . toBe ( "It's a SupErMan!" ) ;
88} ) ;
9+
10+ test ( 'Types check' , ( ) => {
11+ expectTypeOf < ISuperman > ( ) . toMatchTypeOf < IBird > ( ) ;
12+ expectTypeOf < ISuperman > ( ) . toMatchTypeOf < IPlane > ( ) ;
13+ expectTypeOf ( superMan ) . toMatchTypeOf < ISuperman > ( ) ;
14+
15+ expect ( superMan ) . toHaveProperty ( 'canFly' ) ;
16+ expect ( superMan ) . toHaveProperty ( 'isLiving' ) ;
17+ expect ( superMan ) . toHaveProperty ( 'canCarryPeople' ) ;
18+ } ) ;
You can’t perform that action at this time.
0 commit comments