为什么这个函数隐含了任何返回类型?

时间:2017-07-16 17:52:59

标签: typescript

--strict这个

const arr = [''];
arr.map(_ => Observable.of({ json: () => [''] }));

导致此错误 [ts] Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.

然而这没关系

const arr = [''];
const empty = () => [''];
arr.map(_ => Observable.of({ json: empty }));

为什么?

0 个答案:

没有答案