import * as ts from 'typescript' ; import * as implicitRoles from './implicitRoles' ; import { isJsxElement , isJsxSelfClosingElement , isJsxOpeningElement } from './TypeGuard' ; returns { string } export function getImplicitRole ( node ) { let tagName ; if ( isJsxElement ( node ) ) { tagName = node . openingElement . tagName . getText ( ) ; } else if ( isJsxSelfClosingElement ( node ) ) { tagName = node . tagName . getText ( ) ; } else if ( isJsxOpeningElement ( node ) ) { tagName = node . tagName . getText ( ) ; } else { tagName = undefined ; } return tagName && implicitRoles [ tagName ] && implicitRoles [ tagName ] ( node ) ; }