File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
packages/babel-plugin-component-annotate Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ module.exports = {
99 tsconfigRootDir : __dirname ,
1010 project : [ "./src/tsconfig.json" , "./test/tsconfig.json" ] ,
1111 } ,
12+ globals : {
13+ Set : "readonly" ,
14+ } ,
1215 env : {
1316 node : true ,
1417 } ,
Original file line number Diff line number Diff line change @@ -520,14 +520,20 @@ function collectFragmentContext(programPath: Babel.NodePath): FragmentContext {
520520 // Handle destructuring assignments: const { Fragment } = React
521521 if ( varPath . node . id . type === 'ObjectPattern' ) {
522522 if ( init . type === 'Identifier' && reactNamespaceAliases . has ( init . name ) ) {
523- ( varPath . node . id as any ) . properties . forEach ( ( prop : any ) => {
524- if ( prop . type === 'ObjectProperty' &&
525- prop . key ?. type === 'Identifier' &&
526- prop . value ?. type === 'Identifier' &&
527- prop . key . name === 'Fragment' ) {
523+ const properties = varPath . node . id . properties ;
524+
525+ for ( const prop of properties ) {
526+ if (
527+ prop . type === 'ObjectProperty' &&
528+ prop . key &&
529+ prop . key . type === 'Identifier' &&
530+ prop . value &&
531+ prop . value . type === 'Identifier' &&
532+ prop . key . name === 'Fragment'
533+ ) {
528534 fragmentAliases . add ( prop . value . name ) ;
529535 }
530- } ) ;
536+ }
531537 }
532538 }
533539 }
Original file line number Diff line number Diff line change @@ -1848,9 +1848,7 @@ export default function TestComponent() {
18481848 plugins : [ plugin ] ,
18491849 }
18501850 ) ;
1851-
1852- console . log ( "Generated code:" , result ?. code ) ;
1853-
1851+
18541852 // Let's see what's happening
18551853 expect ( result ?. code ) . toBeDefined ( ) ;
18561854} ) ;
You can’t perform that action at this time.
0 commit comments