55
66'use strict' ; 
77
8+ const  values  =  require ( 'object.values' ) ; 
9+ 
810const  Components  =  require ( '../util/Components' ) ; 
911const  astUtil  =  require ( '../util/ast' ) ; 
1012const  docsUrl  =  require ( '../util/docsUrl' ) ; 
@@ -122,7 +124,6 @@ module.exports = {
122124 // -------------------------------------------------------------------------- 
123125
124126 return  { 
125- 
126127 ClassProperty ( node )  { 
127128 if  ( ! propsUtil . isDisplayNameDeclaration ( node ) )  { 
128129 return ; 
@@ -138,7 +139,7 @@ module.exports = {
138139 if  ( ! component )  { 
139140 return ; 
140141 } 
141-  markDisplayNameAsDeclared ( component . node ) ; 
142+  markDisplayNameAsDeclared ( component . node . type   ===   'TSAsExpression'  ?  component . node . expression  :  component . node ) ; 
142143 } , 
143144
144145 FunctionExpression ( node )  { 
@@ -215,7 +216,6 @@ module.exports = {
215216 // This means that we raise a single error for the call to React.memo 
216217 // instead of one for React.memo and one for React.forwardRef 
217218 const  isWrappedInAnotherPragma  =  utils . getPragmaComponentWrapper ( node ) ; 
218- 
219219 if  ( 
220220 ! isWrappedInAnotherPragma 
221221 &&  ( ignoreTranspilerName  ||  ! hasTranspilerName ( node . arguments [ 0 ] ) ) 
@@ -232,8 +232,8 @@ module.exports = {
232232 'Program:exit' ( )  { 
233233 const  list  =  components . list ( ) ; 
234234 // Report missing display name for all components 
235-  Object . keys ( list ) . filter ( ( component )  =>  ! list [ component ] . hasDisplayName ) . forEach ( ( component )  =>  { 
236-  reportMissingDisplayName ( list [ component ] ) ; 
235+  values ( list ) . filter ( ( component )  =>  ! component . hasDisplayName ) . forEach ( ( component )  =>  { 
236+  reportMissingDisplayName ( component ) ; 
237237 } ) ; 
238238 } , 
239239 } ; 
0 commit comments