nl_tokens: Gets the inner checks for a given return type . This is used for async functions and generators . Returns either null or an array of check nodes in the format : Y R N .
pl_tokens: function getFunctionInnerChecks ( context : ConversionContext , path : NodePath , returnType : NodePath ) : ? Array < ? <mask> > { if ( ! path . node . async && ! path . node . generator ) { return ; } if ( ! returnType . isGenericTypeAnnotation ( ) ) { return ; } const returnTypeParameters = getTypeParameters ( returnType ) ; const id = returnType . get ( 'id' ) ; const name = id . node . name ; if ( returnTypeParameters . length === 0 ) { // We're in an async or generator function but we don't have any type parameters. // We have to treat this as mixed. return [ null , context . call ( 'mixed' ) , null , ] ; } if ( path . node . generator ) { if ( supportedIterableNames [ name ] ) { const extra = [ ] ; for ( const param of returnTypeParameters ) { extra . push ( convert ( context , param ) ) ; } return extra ; } } else if ( path . node . async ) { // Make the return type a union with the promise resolution type. return [ null , context . call ( 'union' , convert ( context , returnTypeParameters [ 0 ] ) , convert ( context , returnType ) ) , null ] ; } }