2016-11-30 61 views
0

我和一些朋友正在做一個重要的學校項目一個很好的網絡應用程序和嗡嗡聲我的app.module.ts中有一些錯誤,剛剛彈出這是奇怪的,因爲我確實有他們和他們不!Angular2 app.module.ts錯誤

錯誤:

Error:(32, 11) TS2345:Argument of type '{ imports:typeof BrowserModule[]; exports: typeof SignupFormComponent[]; declarations: (typeof S...' is not assignable to parameter of type 'NgModule'.Types of property 'declarations' are incompatible.Type '(typeof SignupFormComponent | typeof AppComponent | typeof LoaderComponent | typeof MenuComponent...' is not assignable to type '(any[] | Type<any>)[]'.Type 'typeof SignupFormComponent | typeof AppComponent | typeof LoaderComponent | typeof MenuComponent ...' is not assignable to type 'any[] | Type<any>'.Type 'typeof ViewRecipeModalComponent' is not assignable to type 'any[] | Type<any>'.Type 'typeof ViewRecipeModalComponent' is not assignable to type 'Type<any>'.Cannot assign a 'private' constructor type to a 'public'  constructor type. 

這是app.module.ts

import {NgModule} from '@angular/core'; 
    import {BrowserModule} from '@angular/platform-browser'; 
    import {FormsModule} from '@angular/forms'; 
    import {HttpModule} from '@angular/http'; 

    import './rxjs-extensions'; 
    import {AppComponent} from './app.component'; 
    import {AppRoutingModule, routedComponents} from './app-routing.module'; 
    import {Backend} from './shared/services/backend'; 
    import {MenuComponent} from './menu/menu.component'; 
    import {PlannerComponent} from './planner/planner.component'; 
    import {PlannerMenuComponent} from './planner/planner-menu/planner-menu.component'; 
    import {LoginComponent} from './forms/login/login.component'; 
    import {SignupFormComponent} from './forms/signup/signup-form.component'; 
    import {ListsComponent} from './lists/lists.component'; 
    import {ListEntryControlsComponent} from "./lists/list-entry-controls/list-entry-controls.component"; 
    import {ListEntryFoodComponent} from './lists/list-entry-food/list-entry-food.component'; 
    import {ListEntryRecipeComponent} from './lists/list-entry-recipe/list-entry-recipe.component'; 
    import {ListTopBarComponent} from './lists/list-top-bar/list-top-bar.component'; 
    import {LoaderComponent} from "./loader/loader.component"; 
    import {ListErrorComponent} from "./lists/list-error/list-error.component"; 
    import {RecipeModalComponent} from "./forms/modals/recipe/recipe-modal.component"; 
    import {CreateFoodModalComponent} from "./forms/modals/create-food/create-food-modal.component"; 
    import {ViewRecipeModalComponent} from "./forms/modals/view-recipe/view-recipe-modal.component"; 
    import {Typeahead} from "./forms/typehead/typehead.component"; 
    import {PlannerWeekGridComponent} from "./planner/planner-week-grid/planner-week-grid.component"; 
    import {PlannerWeekCellComponent} from "./planner/planner-week-cell/planner-week-cell.component"; 
    import {DynamicUnitComponent} from "./forms/dynamic-unit/dynamic-unit.component"; 
    import {TagsEditorComponent} from "./forms/tags-editor/tags-editor.component"; 
    import {PromoBooksComponent} from "./books/promo-books/promo-books.component"; 

    @NgModule({ 
   imports: [ 
     BrowserModule, 
     FormsModule, 
     AppRoutingModule, 
     HttpModule 
      ], 
      exports: [ 
    SignupFormComponent 
  ], 
  declarations: [ 
    AppComponent, 
    LoaderComponent, 
    MenuComponent, 
    PlannerMenuComponent, 
    PlannerWeekCellComponent, 
    PlannerWeekGridComponent, 
    PlannerComponent, 
    LoginComponent, 
    SignupFormComponent, 
    ListsComponent, 
    ListErrorComponent, 
    ListEntryControlsComponent, 
    ListEntryFoodComponent, 
    ListEntryRecipeComponent, 
    ListTopBarComponent, 
    ViewRecipeModalComponent, 
    RecipeModalComponent, 
    CreateFoodModalComponent, 
    TagsEditorComponent, 
    Typeahead, 
    DynamicUnitComponent, 
    routedComponents, 
    PromoBooksComponent 
  ], 
  providers: [ 
    Backend 
  ], 
  bootstrap: [AppComponent] 
}) 
export class AppModule { 
} 

我只是重新克隆整個項目和問題依然存在。我正在使用webstorm最新版本。順便說一句,我能夠npm啓動應用程序並運行它我只是無法弄清楚webstorm中的這個錯誤。該錯誤從ng模塊的第一個括號開始。

+0

如果代碼有效,那麼這可能只是webstorm的一個問題。你有打字稿所需的所有必要插件嗎?看看這裏http://www.jetbrains.com/help/webstorm/2016.2/typescript-support.html – peppermcknight

回答

0

這是由一個私有構造函數引起的。