这在TypeScript 2.1.5中编译时没有错误: return new Promise(resolve为什么类型不匹配没有被类型记录的编译器捕获和报告?
再看一看,使用异步函数定义,编译器可以正确地报告类型不匹配。async function promiseANumber(): Promise<number> {
return 'definitely not a num
角14增加了一个名为FormRecord的新类,它允许创建比FormGroup更动态的表单控件。Docs有一个这样的例子
FormRecord接受一个泛型参数,该参数描述它包含的控件的类型。let numbers = new FormRecord({bill: '415-123-456'}); // TS2322: Type 'string' is not assignable to typenumbers.addContro
TS2345: Argument of type 'X' is not assignable to parameter of type 'Y'.或
error TS2322: Type '() => number' is not assignable to type 'number'.通常,这样的错误是在我们运行应用程序时捕获的,因为我们的linting没有捕捉到它们,但是我希望在我们的构建系统
我刚刚将角度6.1升级到7,在我的Auth拦截器上遇到了以下错误:
ERROR in src/app/core/interceptors/auth.interceptor.ts(31,9): errorTS2322: Type 'Observable<{} | HttpProgressEvent | HttpSentEvent | HttpHeaderResponse | HttpResponse<Property 'type' is missing in type '