File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { transform } from './transform';
33
44const metadataMacro : MacroHandler = ( { references } ) => {
55 references . default . forEach ( reference => {
6- const decorator = reference . findParent ( parent => parent . isDecorator ( ) )
6+ const decorator = reference . findParent ( parent => parent . isDecorator ( ) ) ;
77 if ( ! decorator ) {
88 throw new Error ( "Metadata macro should be used as class decorator" ) ;
99 }
@@ -12,10 +12,11 @@ const metadataMacro: MacroHandler = ({ references }) => {
1212 throw new Error ( "Metadata macro should be used as class decorator" ) ;
1313 }
1414 if ( classDeclaration . isClassDeclaration ( ) ) {
15- if ( classDeclaration . node . decorators ) {
16- classDeclaration . node . decorators = classDeclaration . node . decorators . filter ( it => it !== decorator . node ) ;
15+ if ( ! classDeclaration . node . decorators ) {
16+ classDeclaration . node . decorators = [ ] ;
1717 }
1818 transform ( classDeclaration ) ;
19+ classDeclaration . node . decorators = classDeclaration . node . decorators . filter ( it => it !== decorator . node ) ;
1920 }
2021 } )
2122} ;
Original file line number Diff line number Diff line change 11import { PluginObj } from '@babel/core' ;
22import { declare } from '@babel/helper-plugin-utils' ;
3- import { parameterVisitor } from './parameter/parameterVisitor' ;
4- import { metadataVisitor } from './metadata/metadataVisitor' ;
53import { transform } from './transform' ;
64
75export default declare (
You can’t perform that action at this time.
0 commit comments