Here is my first simple Hello World
angular 2 app from Angular 2 quick start guide.
import {Component} from 'angular2/core'; import {bootstrap} from 'angular2/platform/browser'; @Component({ selector: 'ng2-app', template: '<h1>My first Angular 2 App</h1>' }) export class AppComponent { } bootstrap(AppComponent);
The application runs fine when I run with npm start
but my IntelliJ IDE is showing error in the line with bootstrap(AppComponent)
Argument type AppComponent is not assignable to parameter type Type
Looking at the bootstrap
function declaration, AppComponent
needs to extends Type
.
export declare function bootstrap(appComponentType: Type, customProviders?: Array<any>): Promise<ComponentRef>;
My question is:
Is it expected for Angular components to extend Type
?
I stumbled on this in Intellij 2016.1.2, with the Angular quickstart demo. Setting the following options in IDE helped:
adding comment / annotation like shown below solves the problem
//noinspection TypeScriptValidateTypes bootstrap(AppComponent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With