File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 "program" : " ${workspaceFolder}/lib/start.js" ,
1313 "cwd" : " ${workspaceFolder}/../../build-tests/api-extractor-test-01" ,
1414 "args" : [
15+ " -d" ,
1516 " run" ,
1617 " -l"
1718 ]
2324 "program" : " ${workspaceFolder}/lib/start.js" ,
2425 "cwd" : " ${workspaceFolder}/../../build-tests/api-extractor-test-02" ,
2526 "args" : [
27+ " -d" ,
2628 " run" ,
2729 " -l"
2830 ]
3436 "program" : " ${workspaceFolder}/lib/start.js" ,
3537 "cwd" : " ${workspaceFolder}/../../build-tests/api-extractor-test-04" ,
3638 "args" : [
39+ " -d" ,
3740 " run" ,
3841 " -l"
3942 ]
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
22// See LICENSE in the project root for license information.
33
4- import { CommandLineParser } from '@microsoft/ts-command-line' ;
4+ import { CommandLineParser , CommandLineFlagParameter } from '@microsoft/ts-command-line' ;
55import { RunAction } from './RunAction' ;
66
77export class ApiExtractorCommandLine extends CommandLineParser {
8+ private _debugParameter : CommandLineFlagParameter ;
9+
810 constructor ( ) {
911 super ( {
1012 toolFilename : 'api-extractor' ,
@@ -14,6 +16,24 @@ export class ApiExtractorCommandLine extends CommandLineParser {
1416 }
1517
1618 protected onDefineParameters ( ) : void { // override
19+ this . _debugParameter = this . defineFlagParameter ( {
20+ parameterLongName : '--debug' ,
21+ parameterShortName : '-d' ,
22+ description : 'Show the full call stack if an error occurs while executing the tool'
23+ } ) ;
24+ }
25+
26+ protected onExecute ( ) : Promise < void > { // override
27+ return super . onExecute ( ) . catch ( ( error ) => {
28+
29+ if ( this . _debugParameter . value ) {
30+ console . error ( os . EOL + error . stack ) ;
31+ } else {
32+ console . error ( os . EOL + colors . red ( 'ERROR: ' + error . message . trim ( ) ) ) ;
33+ }
34+
35+ process . exitCode = 1 ;
36+ } ) ;
1737 }
1838
1939 private _populateActions ( ) : void {
Original file line number Diff line number Diff line change @@ -93,6 +93,26 @@ export class SymbolAnalyzer {
9393 current = currentAlias ;
9494 }
9595
96+ // Is the followedSymbol actually the kind of thing that can be ambient?
97+ if ( isAmbient ) {
98+ for ( const declaration of current . declarations || [ ] ) {
99+ switch ( declaration . kind ) {
100+ case ts . SyntaxKind . ClassDeclaration :
101+ case ts . SyntaxKind . InterfaceDeclaration :
102+ case ts . SyntaxKind . FunctionDeclaration :
103+ case ts . SyntaxKind . ModuleDeclaration :
104+ case ts . SyntaxKind . VariableDeclaration :
105+ // These actually need "export" keywords
106+ break ;
107+ default :
108+ // Everything else we assume is some kind of nested declaration that
109+ // doesn't need it.
110+ isAmbient = false ;
111+ break ;
112+ }
113+ }
114+ }
115+
96116 return {
97117 followedSymbol : current ,
98118 localName : declarationName || current . name ,
You can’t perform that action at this time.
0 commit comments