@@ -55,7 +55,8 @@ const supportedVersionMajorMinor = packageInfo.peerDependencies.typescript
5555 */
5656function getEntryPointsForPackages (
5757 logger : Logger ,
58- packageGlobPaths : string [ ]
58+ packageGlobPaths : string [ ] ,
59+ willEmit : boolean
5960) : DocumentationEntryPoint [ ] | undefined {
6061 const results = new Array < DocumentationEntryPoint > ( ) ;
6162 // --packages arguments are workspace tree roots, or glob patterns
@@ -114,7 +115,7 @@ function getEntryPointsForPackages(
114115 }
115116 const program = ts . createProgram ( {
116117 rootNames : parsedCommandLine . fileNames ,
117- options : parsedCommandLine . options ,
118+ options : fixCompilerOptions ( parsedCommandLine . options , willEmit ) ,
118119 } ) ;
119120 const sourceFile = program . getSourceFile ( packageEntryPoint ) ;
120121 if ( sourceFile === undefined ) {
@@ -133,6 +134,16 @@ function getEntryPointsForPackages(
133134 return results ;
134135}
135136
137+ function fixCompilerOptions (
138+ options : ts . CompilerOptions ,
139+ willEmit : boolean
140+ ) : ts . CompilerOptions {
141+ return {
142+ ...options ,
143+ noEmit : willEmit === false ,
144+ } ;
145+ }
146+
136147function getModuleName ( fileName : string , baseDir : string ) {
137148 return normalizePath ( Path . relative ( baseDir , fileName ) ) . replace (
138149 / ( \/ i n d e x ) ? ( \. d ) ? \. [ t j ] s x ? $ / ,
@@ -181,20 +192,21 @@ export class Application extends ChildableComponent<
181192
182193 options : Options ;
183194
195+ /** @internal */
184196 @BindOption ( "logger" )
185197 loggerType ! : string | Function ;
186198
199+ /** @internal */
187200 @BindOption ( "exclude" )
188201 exclude ! : Array < string > ;
189202
203+ /** @internal */
190204 @BindOption ( "entryPoints" )
191205 entryPoints ! : string [ ] ;
192206
193- @BindOption ( "options" )
194- optionsFile ! : string ;
195-
196- @BindOption ( "tsconfig" )
197- project ! : string ;
207+ /** @internal */
208+ @BindOption ( "emit" )
209+ emit ! : boolean ;
198210
199211 /**
200212 * The version number of TypeDoc.
@@ -324,7 +336,11 @@ export class Application extends ChildableComponent<
324336 }
325337
326338 const packages = this . options . getValue ( "packages" ) . map ( normalizePath ) ;
327- const entryPoints = getEntryPointsForPackages ( this . logger , packages ) ;
339+ const entryPoints = getEntryPointsForPackages (
340+ this . logger ,
341+ packages ,
342+ this . emit
343+ ) ;
328344 if ( entryPoints === undefined ) {
329345 return ;
330346 }
@@ -422,7 +438,7 @@ export class Application extends ChildableComponent<
422438
423439 const host = ts . createWatchCompilerHost (
424440 tsconfigFile ,
425- { noEmit : ! this . options . getValue ( " emit" ) } ,
441+ fixCompilerOptions ( { } , this . emit ) ,
426442 ts . sys ,
427443 ts . createEmitAndSemanticDiagnosticsBuilderProgram ,
428444 ( diagnostic ) => this . logger . diagnostic ( diagnostic ) ,
@@ -599,7 +615,10 @@ export class Application extends ChildableComponent<
599615 private getEntryPrograms ( ) {
600616 const rootProgram = ts . createProgram ( {
601617 rootNames : this . options . getFileNames ( ) ,
602- options : this . options . getCompilerOptions ( ) ,
618+ options : fixCompilerOptions (
619+ this . options . getCompilerOptions ( ) ,
620+ this . emit
621+ ) ,
603622 projectReferences : this . options . getProjectReferences ( ) ,
604623 } ) ;
605624
@@ -617,7 +636,10 @@ export class Application extends ChildableComponent<
617636
618637 programs . push (
619638 ts . createProgram ( {
620- options : ref . commandLine . options ,
639+ options : fixCompilerOptions (
640+ ref . commandLine . options ,
641+ this . emit
642+ ) ,
621643 rootNames : ref . commandLine . fileNames ,
622644 projectReferences : ref . commandLine . projectReferences ,
623645 } )
0 commit comments