import type * as ts from 'typescript' ; import { GetMockFactoryCallIntersection } from '../../mockFactoryCall/mockFactoryCall' ; import { Scope } from '../../scope/scope' ; import { core } from '../../core/core' ; import { TypescriptHelper } from '../helper/helper' ; import { GetTypes } from '../type/type' ; import { GetUndefinedDescriptor } from '../undefined/undefined' ; export function GetIntersectionDescriptor ( intersectionTypeNode , scope ) { const nodes = GetTypes ( intersectionTypeNode . types , scope ) ; const hasInvalidIntersections = nodes . some ( ( node ) => TypescriptHelper . IsLiteralOrPrimitive ( node ) || core . ts . isTypeQueryNode ( node ) ) ; if ( hasInvalidIntersections ) { return GetUndefinedDescriptor ( ) ; } return GetMockFactoryCallIntersection ( intersectionTypeNode , scope ) ; }