import ts from 'typescript' ; import * as utils from './utils' ; type ExpressionedNode = ts . Node & { readonly expression : ts . Expression ; } ; type MaybeExpressionedNode = ts . Node & { readonly expression ? : ts . Expression ; } ; export function getExpression ( expression ) ; export function getExpression ( expression ) ; export function getExpression ( expression ) { return utils . getValueOrUndefined ( expression . expression ) ; } export function getExpressionForCall ( node ) { if ( ts . isCallExpression ( node ) || ts . isNewExpression ( node ) || ts . isDecorator ( node ) ) { return getExpression ( node ) ; } if ( ts . isJsxSelfClosingElement ( node ) || ts . isJsxOpeningElement ( node ) ) { return node . tagName ; } return node . tag ; } export function getElements ( expression ) { const elements = utils . getValueOrUndefined ( expression . elements ) ; return elements === undefined ? [ ] : elements ; } export function getLeft ( expression ) { return expression . left ; } export function getOperatorToken ( expression ) { return expression . operatorToken ; } export function getRight ( expression ) { return expression . right ; } export function getArguments ( expression ) { return expression . arguments ; } export function getArgumentExpression ( expression ) { return utils . getValueOrUndefined ( expression . argumentExpression ) ; } export function getArgumentExpressionOrThrow ( expression ) { return utils . throwIfNullOrUndefined ( getArgumentExpression ( expression ) , 'argument' ) ; } export function getCondition ( expression ) { return expression . condition ; } export function getWhenTrue ( expression ) { return expression . whenTrue ; } export function getWhenFalse ( expression ) { return expression . whenFalse ; } export function getOperand ( expression ) ; export function getOperand ( expression ) ; export function getOperand ( expression ) { return expression . operand ; } export function getOperator ( expression ) ; export function getOperator ( expression ) ; export function getOperator ( expression ) { return expression . operator ; }