@@ -74,22 +74,21 @@ export class TSHelper {
7474 && ( typeNode as ts . UnionOrIntersectionTypeNode ) . types . some ( this . isArrayTypeNode ) ) ;
7575 }
7676
77- public static isArrayType ( type : ts . Type , checker : ts . TypeChecker , dontCheckBases ?: boolean ) : boolean {
78- if ( ! dontCheckBases ) {
79- // Check if type inherits from Array
80- const baseTypes = type . getBaseTypes ( ) ;
81- if ( baseTypes ) {
82- for ( const baseType of baseTypes ) {
83- const baseTypeNode = checker . typeToTypeNode ( baseType , undefined , ts . NodeBuilderFlags . InTypeAlias ) ;
84- if ( baseTypeNode && this . isArrayTypeNode ( baseTypeNode ) ) { return true ; }
85- }
86- }
87- }
88-
77+ public static isExplicitArrayType ( type : ts . Type , checker : ts . TypeChecker ) : boolean {
8978 const typeNode = checker . typeToTypeNode ( type , undefined , ts . NodeBuilderFlags . InTypeAlias ) ;
9079 return typeNode && this . isArrayTypeNode ( typeNode ) ;
9180 }
9281
82+ public static isArrayType ( type : ts . Type , checker : ts . TypeChecker ) : boolean {
83+ const baseTypes = type . getBaseTypes ( ) ;
84+ if ( baseTypes ) {
85+ for ( const baseType of baseTypes ) {
86+ if ( this . isExplicitArrayType ( baseType , checker ) ) { return true ; }
87+ }
88+ }
89+ return this . isExplicitArrayType ( type , checker ) ;
90+ }
91+
9392 public static isTupleReturnCall ( node : ts . Node , checker : ts . TypeChecker ) : boolean {
9493 if ( ts . isCallExpression ( node ) ) {
9594 const type = checker . getTypeAtLocation ( node . expression ) ;
0 commit comments