ts lint 上的实验装饰器警告
experimentalDecorators Warning on ts lint
我收到打字稿 ts link 警告,由 vs 代码触发。当我将鼠标悬停在 HttpService 的服务名称上时,我明白了,由于某种原因我无法弄清楚它带有下划线。
[ts] Experimental support for decorators is a feature that is subject
to change in a future release. Set the 'experimentalDecorators' option
to remove this warning. class HttpService
我的意思是我可以在 tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true
}
}
这将消除错误,但是,这不是一个好的做法,因为它只是暂时扫除地毯下的污垢。
我们需要做什么才能不必处理这个问题?
这里的准系统样板代码几乎有什么问题吗?
import {Injectable} from '@angular/core';
import {Http, Response, Headers, RequestOptions, ResponseContentType} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/Rx';
@Injectable()
export class HttpService {
constructor(private http: Http) {
}
getData(url: any) {
const headers = new Headers();
// headers.append('','');
return this.http.get(url )
.map((response: Response) => response.json());
}
}
警告您:
@Injectable()
技术上是一项实验性功能。
您需要将 tsconfig.json 更新为:
//...
"experimentalDecorators": true,
//...
我收到打字稿 ts link 警告,由 vs 代码触发。当我将鼠标悬停在 HttpService 的服务名称上时,我明白了,由于某种原因我无法弄清楚它带有下划线。
[ts] Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning. class HttpService
我的意思是我可以在 tsconfig.json
{
"compilerOptions": {
"experimentalDecorators": true,
"allowJs": true
}
}
这将消除错误,但是,这不是一个好的做法,因为它只是暂时扫除地毯下的污垢。
我们需要做什么才能不必处理这个问题?
这里的准系统样板代码几乎有什么问题吗?
import {Injectable} from '@angular/core';
import {Http, Response, Headers, RequestOptions, ResponseContentType} from '@angular/http';
import {Observable} from 'rxjs/Observable';
import 'rxjs/Rx';
@Injectable()
export class HttpService {
constructor(private http: Http) {
}
getData(url: any) {
const headers = new Headers();
// headers.append('','');
return this.http.get(url )
.map((response: Response) => response.json());
}
}
警告您:
@Injectable()
技术上是一项实验性功能。
您需要将 tsconfig.json 更新为:
//...
"experimentalDecorators": true,
//...