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';
3
3
4
4
const metadataMacro : MacroHandler = ( { references } ) => {
5
5
references . default . forEach ( reference => {
6
- const decorator = reference . findParent ( parent => parent . isDecorator ( ) )
6
+ const decorator = reference . findParent ( parent => parent . isDecorator ( ) ) ;
7
7
if ( ! decorator ) {
8
8
throw new Error ( "Metadata macro should be used as class decorator" ) ;
9
9
}
@@ -12,10 +12,11 @@ const metadataMacro: MacroHandler = ({ references }) => {
12
12
throw new Error ( "Metadata macro should be used as class decorator" ) ;
13
13
}
14
14
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 = [ ] ;
17
17
}
18
18
transform ( classDeclaration ) ;
19
+ classDeclaration . node . decorators = classDeclaration . node . decorators . filter ( it => it !== decorator . node ) ;
19
20
}
20
21
} )
21
22
} ;
Original file line number Diff line number Diff line change 1
1
import { PluginObj } from '@babel/core' ;
2
2
import { declare } from '@babel/helper-plugin-utils' ;
3
- import { parameterVisitor } from './parameter/parameterVisitor' ;
4
- import { metadataVisitor } from './metadata/metadataVisitor' ;
5
3
import { transform } from './transform' ;
6
4
7
5
export default declare (
You can’t perform that action at this time.
0 commit comments