add support for async generators to type inferrence

This commit is contained in:
Sebastian McKenzie 2015-06-06 16:17:55 +01:00
parent 1abd3419f6
commit f5cf641c0a

View File

@ -272,10 +272,10 @@ export function _inferTypeAnnotation(force?: boolean): ?Object {
if (callPath) {
var callee = callPath.resolve();
// todo: read typescript/flow interfaces
if (callee.isNodeType("Function")) {
if (callee.isFunction()) {
if (callee.is("async")) {
if (callee.is("generator")) {
// todo
return t.genericTypeAnnotation(t.identifier("AsyncIterator"));
} else {
return t.genericTypeAnnotation(t.identifier("Promise"));
}