@@ -80,15 +80,11 @@ export default createRule('no-unused-props', {
80
80
return shouldIgnore ( typeStr ) || ( symbolName ? shouldIgnore ( symbolName ) : false ) ;
81
81
}
82
82
83
- function isExternalType ( type : ts . Type ) : boolean {
84
- const symbol = type . getSymbol ( ) ;
85
- if ( ! symbol ) return false ;
86
-
83
+ function isInternalProperty ( symbol : ts . Symbol ) : boolean {
87
84
const declarations = symbol . getDeclarations ( ) ;
88
85
if ( ! declarations || declarations . length === 0 ) return false ;
89
86
90
- const sourceFile = declarations [ 0 ] . getSourceFile ( ) ;
91
- return sourceFile . fileName !== fileName ;
87
+ return declarations . every ( ( decl ) => decl . getSourceFile ( ) . fileName === fileName ) ;
92
88
}
93
89
94
90
/**
@@ -200,7 +196,6 @@ export default createRule('no-unused-props', {
200
196
if ( checkedTypes . has ( typeStr ) ) return ;
201
197
checkedTypes . add ( typeStr ) ;
202
198
if ( shouldIgnoreType ( type ) ) return ;
203
- if ( ! checkImportedTypes && isExternalType ( type ) ) return ;
204
199
205
200
const properties = typeChecker . getPropertiesOfType ( type ) ;
206
201
const baseTypes = type . getBaseTypes ( ) ;
@@ -225,6 +220,7 @@ export default createRule('no-unused-props', {
225
220
226
221
for ( const prop of properties ) {
227
222
if ( isBuiltInProperty ( prop ) ) continue ;
223
+ if ( ! checkImportedTypes && ! isInternalProperty ( prop ) ) continue ;
228
224
229
225
const propName = prop . getName ( ) ;
230
226
const currentPath = [ ...parentPath , propName ] ;
0 commit comments