@@ -8,6 +8,7 @@ import { Renderer } from 'typedoc/dist/lib/output/renderer';
88import { RendererComponent } from 'typedoc/dist/lib/output/components' ;
99import { RendererEvent } from 'typedoc/dist/lib/output/events' ;
1010import mkdir from 'make-dir' ;
11+ import Indentor from './render/indentor' ;
1112
1213const declarationFileOption = {
1314 name : 'declarationFile' ,
@@ -30,11 +31,19 @@ const sortOptionOption = {
3031 map : sortMapping ,
3132} as DeclarationOption ;
3233
34+ const indentStringOption = {
35+ name : 'indentString' ,
36+ type : ParameterType . String ,
37+ help : 'Indent declarations using this string. Defaults to \' \'' ,
38+ defaultValue : ' ' ,
39+ } as DeclarationOption ;
40+
3341export class TypeScriptDeclarationPlugin extends RendererComponent {
3442 static options = [
3543 declarationFileOption ,
3644 declarationOnlyOption ,
3745 sortOptionOption ,
46+ indentStringOption ,
3847 ] ;
3948
4049 @BindOption ( declarationFileOption . name )
@@ -76,9 +85,11 @@ export class TypeScriptDeclarationPlugin extends RendererComponent {
7685 . filter ( c => c . componentName !== 'typescript-declaration' )
7786 . forEach ( c => app . renderer . removeComponent ( c . componentName ) ) ;
7887 }
88+
89+ Indentor . indentString = app . options . getValue ( 'indentString' ) as string ;
7990 }
8091
81- private veriftProject ( project : ProjectReflection ) {
92+ private verifyProject ( project : ProjectReflection ) {
8293 if ( this . _declarationOnly && ! this . _declarationFile ) {
8394 throw new Error ( '--declarationFile file must be specified when using the --declarationOnly option' ) ;
8495 }
@@ -97,7 +108,7 @@ export class TypeScriptDeclarationPlugin extends RendererComponent {
97108 }
98109
99110 private onRenderBegin ( event : RendererEvent ) {
100- this . veriftProject ( event . project ) ;
111+ this . verifyProject ( event . project ) ;
101112 }
102113
103114 public static generateTypeDeclarations ( project : ProjectReflection , sortOption : ReflectionSortFlags , filename ?: string ) {
0 commit comments