TS2345类型'{选择器:字符串; templateUrl:字符串; styleUrls:string []; }”不可分配给“组件”类型的参数

时间:2018-09-21 09:29:50

标签: visual-studio-2015 angular5 angular-cli typescript2.2

Visual Studio 2015(更新3)中出现此错误TS2345。 我正在尝试在Visual Studio 2015中集成角度CLI项目

请参阅本文档:https://angular.io/guide/visual-studio-2015

Angular CLI: 6.1.5
Node: 8.9.1
OS: win32 x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.7.5
@angular/cli                      6.1.5
@ngtools/webpack                  6.1.5
@schematics/angular               0.7.5
@schematics/update                0.7.5
rxjs                              6.3.2
typescript                        2.7.2
webpack                           4.9.2

以下是 app.component.ts 文件:

import { Component } from '@angular/core';

@Component({    <-- Error is coming on this line.
  selector: 'my-app',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'NAR';
}

App.component.ts file Error Image VS 2015

Solution Explorer of ASP.NET Web application

任何人都可以解决此错误。自从过去两天以来,我已经在Google上搜索了此错误,但是没有任何解决方案。

我们将不胜感激。 谢谢:)

0 个答案:

没有答案