nl_tokens: Return the contextual signature for a given expression node . A contextual type provides a contextual signature if it has a single call signature and if that call signature is non - generic . If the contextual type is a union type get the signature from each type possible and if they are all identical ignoring their return type the result is same signature but with return type as union type of return types from these signatures
pl_tokens: function getContextualSignature ( node ) { ts . Debug . assert ( node . kind !== 143 /* MethodDeclaration */ || ts . isObjectLiteralMethod ( node ) ) ; var type = ts . isObjectLiteralMethod ( node ) ? getContextualTypeForObjectLiteralMethod ( node ) : getContextualType ( node ) ; if ( ! type ) { return undefined ; } if ( ! ( type . flags & 16384 /* Union */ ) ) { return getNonGenericSignature ( type ) ; } var signatureList ; var types = type . types ; for ( var _i = 0 ; _i < types . length ; _i ++ ) { var current = types [ _i ] ; var signature = getNonGenericSignature ( <mask> ) ; if ( signature ) { if ( ! signatureList ) { // This signature will contribute to contextual union signature signatureList = [ signature ] ; } else if ( ! compareSignatures ( signatureList [ 0 ] , signature , /*partialMatch*/ false , /*ignoreReturnTypes*/ true , compareTypes ) ) { // Signatures aren't identical, do not use return undefined ; } else { // Use this signature for contextual union signature signatureList . push ( signature ) ; } } } // Result is union of signatures collected (return type is union of return types of this signature set) var result ; if ( signatureList ) { result = cloneSignature ( signatureList [ 0 ] ) ; // Clear resolved return type we possibly got from cloneSignature result . resolvedReturnType = undefined ; result . unionSignatures = signatureList ; } return result ; }