问题描述
下面是一些好的示例代码:
interface FooType {
+bar: (boolean) => void
}
class Foo implements FooType {
bar (someArg) {}
}
这里没问题-可以正常工作,没有错误。
现在,如果我们导出Foo
:
interface FooType {
+bar: (boolean) => void
}
class Foo implements FooType {
bar (someArg) {}
}
export default Foo
我们收到以下“缺少类型注释”错误:
6: bar (someArg) {}
^ Missing type annotation for `someArg`. [missing-annot]
赞!
我不清楚为什么会这样。我确实发现this blog post关于“必须注释可从出口到达的输入位置”,但是输入了Foo
,因此应该在导出之前显式输入bar方法。
关于发生了什么的任何线索吗?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)