lib/rules/array-type.js
function isSimpleType(node) {
    switch (node.type) {
        case "Identifier":
        case "TSAnyKeyword":
        case "TSBooleanKeyword":
        case "TSNeverKeyword":
        case "TSNumberKeyword":
        case "TSObjectKeyword":
        case "TSStringKeyword":
        case "TSSymbolKeyword":
        case "TSUnknownKeyword":
        case "TSVoidKeyword":
        case "TSNullKeyword":
        case "TSArrayType":
        case "TSUndefinedKeyword":
        case "TSThisType":
        case "TSQualifiedName":
            return true;
        case "TSTypeReference":
            if (
                node.typeName &&
                node.typeName.type === "Identifier" &&
                node.typeName.name === "Array"
            ) {
                if (!node.typeParameters) {
                    return true;
                }
                if (node.typeParameters.params.length === 1) {
                    return isSimpleType(node.typeParameters.params[0]);
                }
            } else {
                if (node.typeParameters) {
                    return false;
                }
                return isSimpleType(node.typeName);
            }
            return false;
        default:
            return false;
    }
}
function isSimpleType(node) {
    switch (node.type) {
        case "Identifier":
        case "TSAnyKeyword":
        case "TSBooleanKeyword":
        case "TSNeverKeyword":
        case "TSNumberKeyword":
        case "TSObjectKeyword":
        case "TSStringKeyword":
        case "TSSymbolKeyword":
        case "TSUnknownKeyword":
        case "TSVoidKeyword":
        case "TSNullKeyword":
        case "TSArrayType":
        case "TSUndefinedKeyword":
        case "TSThisType":
        case "TSQualifiedName":
            return true;
        case "TSTypeReference":
            if (
                node.typeName &&
                node.typeName.type === "Identifier" &&
                node.typeName.name === "Array"
            ) {
                if (!node.typeParameters) {
                    return true;
                }
                if (node.typeParameters.params.length === 1) {
                    return isSimpleType(node.typeParameters.params[0]);
                }
            } else {
                if (node.typeParameters) {
                    return false;
                }
                return isSimpleType(node.typeName);
            }
            return false;
        default:
            return false;
    }
}
function isSimpleType ( node ) { switch ( node . type ) { case "Identifier" : case "TSAnyKeyword" : case "TSBooleanKeyword" : case "TSNeverKeyword" : case "TSNumberKeyword" : case "TSObjectKeyword" : case "TSStringKeyword" : case "TSSymbolKeyword" : case "TSUnknownKeyword" : case "TSVoidKeyword" : case "TSNullKeyword" : case "TSArrayType" : case "TSUndefinedKeyword" : case "TSThisType" : case "TSQualifiedName" : return true ; case "TSTypeReference" : if ( node . typeName && node . typeName . type === "Identifier" && node . typeName . name === "Array" ) { if ( ! node . typeParameters ) { return true ; } if ( node . typeParameters . params . length === 1 ) { return isSimpleType ( node . typeParameters . params [ 0 ] ) ; } } else { if ( node . typeParameters ) { return false ; } return isSimpleType ( node . typeName ) ; } return false ; default : return false ; } }
Check whatever node can be considered as simple
@param {ASTNode} node the node to be evaluated.
@returns {*} true or false
Check whatever node can be considered as simple