[英]This arrow function body can be simplified by omitting the curly braces and the keyword 'return'.tslint(arrow-return-shorthand)
我的目的是读取一个文件 json,其中包含我输入项目的所有名称
{ 'home':'home'}:
我创建了服务,但我这样做:
getPropertiesName(): Observable<Object> {
return this.http.get('assets/config/propertiesName.json').pipe(map((response: Response) => { return response.json(); }));
}
问题是编译器给了我这个错误:
This arrow function body can be simplified by omitting the curly braces and the keyword 'return'.tslint(arrow-return-shorthand)
任何人都可以帮我解决这个问题吗?
adsds 是一样的
this.http.get(...).pipe(map((response: Response) => { return response.json(); }));
比
this.http.get(...).pipe(map((response: Response) => response.json();));
顺便说一句,您的响应还不是一个 json,转换为 json 没有任何意义
这是来自 tslint 的 lint 错误,并且可能会自动修复。 尝试运行:
ng lint --fix
然后结合您发布的错误消息考虑差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.