This repository was archived by the owner on Nov 9, 2017. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +32
-7
lines changed Expand file tree Collapse file tree 3 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -2255,6 +2255,10 @@ export default class
2255
2255
//this property can be ignored
2256
2256
return null ;
2257
2257
}
2258
+ if ( propertyDeclaration . questionToken )
2259
+ {
2260
+ return null ;
2261
+ }
2258
2262
let isStatic = false ;
2259
2263
if ( propertyDeclaration . modifiers )
2260
2264
{
@@ -2281,6 +2285,10 @@ export default class
2281
2285
//this property can be ignored
2282
2286
return ;
2283
2287
}
2288
+ if ( propertyDeclaration . questionToken )
2289
+ {
2290
+ return null ;
2291
+ }
2284
2292
let isStatic = false ;
2285
2293
if ( propertyDeclaration . modifiers )
2286
2294
{
@@ -2441,6 +2449,10 @@ export default class
2441
2449
//this method can be ignored
2442
2450
return null ;
2443
2451
}
2452
+ if ( functionDeclaration . questionToken )
2453
+ {
2454
+ return null ;
2455
+ }
2444
2456
let isStatic = false ;
2445
2457
if ( functionDeclaration . modifiers )
2446
2458
{
@@ -2468,6 +2480,10 @@ export default class
2468
2480
//this method can be ignored
2469
2481
return ;
2470
2482
}
2483
+ if ( functionDeclaration . questionToken )
2484
+ {
2485
+ return null ;
2486
+ }
2471
2487
let typeParameters = this . populateTypeParameters ( functionDeclaration ) ;
2472
2488
let isStatic = false ;
2473
2489
if ( functionDeclaration . modifiers )
Original file line number Diff line number Diff line change 1
1
export interface InterfaceWithOptionalMembers
2
2
{
3
- method1 ( ) : number ;
4
- method2 ?( ) : boolean ;
5
- }
6
-
7
- export class ClassImplementsInterfaceWithOptionalMembers implements InterfaceWithOptionalMembers
8
- {
9
- method1 ( ) ;
3
+ method1 ?( ) : number ;
4
+ method2 ( ) : boolean ;
10
5
}
Original file line number Diff line number Diff line change @@ -459,6 +459,20 @@ describe("An interface", () =>
459
459
let as3MethodType = < as3 . TypeDefinition > as3 . getDefinitionByName ( "Number" , symbols ) ;
460
460
expect ( method . type ) . toBe ( as3MethodType ) ;
461
461
} ) ;
462
+ it ( "must skip optional methods" , ( ) =>
463
+ {
464
+ let symbols = parser . parse ( [ "spec/fixtures/interface-optional-members.d.ts" ] ) . definitions ;
465
+ let as3Interface = < as3 . TypeDefinition > as3 . getDefinitionByName ( "InterfaceWithOptionalMembers" , symbols ) ;
466
+ expect ( as3Interface ) . not . toBeNull ( ) ;
467
+ expect ( as3Interface . methods . length ) . toBe ( 1 ) ;
468
+ let method = as3Interface . methods [ 0 ] ;
469
+ expect ( method ) . not . toBeNull ( ) ;
470
+ expect ( method . name ) . toBe ( "method2" ) ;
471
+ expect ( method . accessLevel ) . toBeNull ( ) ;
472
+ expect ( method . isStatic ) . toBe ( false ) ;
473
+ let as3MethodType = < as3 . TypeDefinition > as3 . getDefinitionByName ( "Boolean" , symbols ) ;
474
+ expect ( method . type ) . toBe ( as3MethodType ) ;
475
+ } ) ;
462
476
it ( "may extend another interface" , ( ) =>
463
477
{
464
478
let symbols = parser . parse ( [ "spec/fixtures/interface-extends-interface.d.ts" ] ) . definitions ;
You can’t perform that action at this time.
0 commit comments