@@ -856,10 +856,11 @@ function convertVariable(
856856 exportSymbol ?: ts . Symbol ,
857857) {
858858 const declaration = symbol . getDeclarations ( ) ?. [ 0 ] ;
859- assert ( declaration ) ;
860859
861860 const comment = context . getComment ( symbol , ReflectionKind . Variable ) ;
862- const type = context . checker . getTypeOfSymbolAtLocation ( symbol , declaration ) ;
861+ const type = declaration
862+ ? context . checker . getTypeOfSymbolAtLocation ( symbol , declaration )
863+ : context . checker . getTypeOfSymbol ( symbol ) ;
863864
864865 if (
865866 isEnumLike ( context . checker , type , declaration ) &&
@@ -883,7 +884,7 @@ function convertVariable(
883884 ) ;
884885
885886 let typeNode : ts . TypeNode | undefined ;
886- if ( ts . isVariableDeclaration ( declaration ) ) {
887+ if ( declaration && ts . isVariableDeclaration ( declaration ) ) {
887888 // Otherwise we might have destructuring
888889 typeNode = declaration . type ;
889890 }
@@ -902,8 +903,12 @@ function convertVariable(
902903 return ts . SymbolFlags . Property ;
903904}
904905
905- function isEnumLike ( checker : ts . TypeChecker , type : ts . Type , location : ts . Node ) {
906- if ( ! hasAllFlags ( type . flags , ts . TypeFlags . Object ) ) {
906+ function isEnumLike (
907+ checker : ts . TypeChecker ,
908+ type : ts . Type ,
909+ location ?: ts . Node ,
910+ ) {
911+ if ( ! location || ! hasAllFlags ( type . flags , ts . TypeFlags . Object ) ) {
907912 return false ;
908913 }
909914
0 commit comments