import { eat , lookaheadType , match } from "../tokenizer/index" ; import { TokenType as tt } from "../tokenizer/types" ; import { state } from "../traverser/base" ; import { baseParseConditional } from "../traverser/expression" ; import { tsParseTypeAnnotation } from "./typescript" ; /**
 * Common parser code for TypeScript and Flow.
 */ export function typedParseConditional ( noIn ) { if ( match ( tt . question ) ) { const nextType = lookaheadType ( ) ; if ( nextType === tt . colon || nextType === tt . comma || nextType === tt . parenR ) { return ; } } baseParseConditional ( noIn ) ; } export function typedParseParenItem ( ) { if ( eat ( tt . question ) ) { state . tokens [ state . tokens . length - 1 ] . isType = true ; } if ( match ( tt . colon ) ) { if ( true ) { tsParseTypeAnnotation ( ) ; } } }