File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,18 @@ export class MetadataManager {
2424 metadata : string ,
2525 symbol : string ,
2626 staticOptions ?: DeclarationOptions [ 'staticOptions' ] ,
27- ) : string {
27+ ) : string | undefined {
2828 const source : SourceFile = createSourceFile (
2929 'filename.ts' ,
3030 this . content ,
3131 ScriptTarget . ES2017 ,
3232 ) ;
3333 const decoratorNodes : Node [ ] = this . getDecoratorMetadata ( source , '@Module' ) ;
3434 const node : Node = decoratorNodes [ 0 ] ;
35+ // If there is no occurrence of `@Module` decorator, nothing will be inserted
36+ if ( ! node ) {
37+ return ;
38+ }
3539 const matchingProperties : ObjectLiteralElement [ ] = (
3640 node as ObjectLiteralExpression
3741 ) . properties
Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ export class ModuleMetadataDeclarator {
99 options . symbol ,
1010 options . staticOptions ,
1111 ) ;
12- return inserted ;
12+ return inserted ?? content ;
1313 }
1414}
You can’t perform that action at this time.
0 commit comments