File tree 3 files changed +12
-10
lines changed
misc/structured-types/src
3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -501,7 +501,7 @@ export class SymbolParser implements ISymbolParser {
501
501
) : PropType | null {
502
502
const symbolDeclaration =
503
503
symbol . valueDeclaration || symbol . declarations ?. [ 0 ] ;
504
- if ( symbolDeclaration ) {
504
+ if ( true ) {
505
505
const symbolType = getSymbolType ( this . checker , symbol ) ;
506
506
507
507
const typeSymbol = symbolType
@@ -513,7 +513,7 @@ export class SymbolParser implements ISymbolParser {
513
513
if ( ( declaration as ts . ParameterDeclaration ) . questionToken ) {
514
514
prop . optional = true ;
515
515
}
516
- if ( declaration . modifiers ) {
516
+ if ( declaration ? .modifiers ) {
517
517
for ( const m of declaration . modifiers ) {
518
518
if ( m . kind === ts . SyntaxKind . PrivateKeyword ) {
519
519
prop . visibility = 'private' ;
@@ -530,7 +530,7 @@ export class SymbolParser implements ISymbolParser {
530
530
}
531
531
}
532
532
}
533
- if ( 'name' in declaration ) {
533
+ if ( declaration ) {
534
534
prop . displayName = getDeclarationName ( declaration ) ;
535
535
}
536
536
if ( symbolType ) {
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export const typeResolver: TypeResolver = (
15
15
...reactOptions ,
16
16
} ;
17
17
if ( ( symbolType . flags & ts . TypeFlags . Object ) === ts . TypeFlags . Object ) {
18
- if ( isObjectTypeDeclaration ( declaration ) ) {
18
+ if ( declaration && isObjectTypeDeclaration ( declaration ) ) {
19
19
const heritage = declaration . heritageClauses ;
20
20
if ( heritage ?. length ) {
21
21
const extendsFrom = heritage [ 0 ] ;
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ export type DocsOptions = CompileOptions & ParseOptions;
218
218
219
219
export type TypeResolver = ( props : {
220
220
symbolType : ts . Type ;
221
- declaration : ts . Declaration ;
221
+ declaration ? : ts . Declaration ;
222
222
checker : ts . TypeChecker ;
223
223
} ) => { type : ts . Type | undefined ; intializer ?: ts . Node ; name ?: string } ;
224
224
@@ -296,12 +296,14 @@ export interface ISymbolParser {
296
296
}
297
297
298
298
export const getInitializer = (
299
- declaration : ts . Node ,
299
+ declaration ? : ts . Node ,
300
300
) : ts . Expression | undefined =>
301
- isVariableLikeDeclaration ( declaration )
302
- ? declaration ?. initializer
303
- : ts . isBinaryExpression ( declaration . parent )
304
- ? declaration . parent . right
301
+ declaration
302
+ ? isVariableLikeDeclaration ( declaration )
303
+ ? declaration ?. initializer
304
+ : ts . isBinaryExpression ( declaration . parent )
305
+ ? declaration . parent . right
306
+ : undefined
305
307
: undefined ;
306
308
307
309
type NodeCallback = ( m : ts . PropertyDeclaration ) => boolean ;
You can’t perform that action at this time.
0 commit comments