@@ -139,6 +139,11 @@ function createTransformerFactory(program: ts.Program, options?: Partial<RenameO
139139 return handleBindingElement ( node ) ;
140140 }
141141
142+ // <Comp node={...} />
143+ if ( ts . isJsxAttribute ( node . parent ) && node . parent . name === node ) {
144+ return handleJsxAttributeName ( node ) ;
145+ }
146+
142147 // constructor(public node: string) { // <--- this
143148 // console.log(node); // <--- and this
144149 // }
@@ -207,6 +212,11 @@ function createTransformerFactory(program: ts.Program, options?: Partial<RenameO
207212 return createNewIdentifier ( node ) ;
208213 }
209214
215+ // <Comp node={...} />
216+ function handleJsxAttributeName ( node : ts . Identifier ) : ts . Identifier {
217+ return createNewIdentifier ( node ) ;
218+ }
219+
210220 // const a = { node: 123 }
211221 function handlePropertyAssignment ( node : ts . Identifier ) : ts . Identifier {
212222 return createNewIdentifier ( node ) ;
@@ -425,6 +435,17 @@ function createTransformerFactory(program: ts.Program, options?: Partial<RenameO
425435 return VisibilityType . External ;
426436 }
427437
438+ // <Comp node={...} />
439+ if ( ts . isJsxAttribute ( node . parent ) ) {
440+ const jsxTagSymbol = typeChecker . getSymbolAtLocation ( node . parent . parent . parent . tagName ) ;
441+ if ( jsxTagSymbol !== undefined && jsxTagSymbol . valueDeclaration !== undefined ) {
442+ const jsxPropsType = typeChecker . getTypeOfSymbolAtLocation ( jsxTagSymbol , jsxTagSymbol . valueDeclaration ) ;
443+ if ( isTypePropertyExternal ( jsxPropsType , node . getText ( ) ) ) {
444+ return VisibilityType . External ;
445+ }
446+ }
447+ }
448+
428449 const nodeSymbol = getNodeSymbol ( node ) ;
429450 const classOfMember = nodeSymbol !== null ? getClassOfMemberSymbol ( nodeSymbol ) : null ;
430451 if ( classOfMember !== null && isTypePropertyExternal ( typeChecker . getTypeAtLocation ( classOfMember ) , node . getText ( ) ) ) {
0 commit comments