node_modules/ag-grid/main"' 没有导出成员 'IHeaderGroup'

node_modules/ag-grid/main"' has no exported member 'IHeaderGroup'

我是 angular 4 的新手,正在尝试从这里 https://www.ag-grid.com/ag-grid-angular-angularcli/#gsc.tab=0.

使用 ag-grid

我不断收到如下错误,我找不到任何有用的链接:

node_modules/ag-grid-angular/dist/interfaces.d.ts (1,10): Module '"C:/Use rs/shm/A4/first-app/node_modules/ag-grid/main"' has no exported member 'IHeaderGroup'.

node_modules/ag-grid-angular/dist/interfaces.d.ts (1,24): Module '"C:/Use rs/shm/A4/first-app/node_modules/ag-grid/main"' has no exported member 'IHeaderGroupParams'.

ag-grid-angular/dist/interfaces.d.ts (1,44): Module '"C:/Use rs/shm/A4/first-app/node_modules/ag-grid/main"' has no exported member 'IHeader'.

//app.module.ts
import {AgGridModule} from 'ag-grid-angular';
import { RedComponentComponent } from './red-component/red-component.component';
import { MyAgGridComponent } from './my-ag-grid/my-ag-grid.component';

        @NgModule({
          declarations: [
            AppComponent,
            SpinnerComponent,
            RedComponentComponent,
            MyAgGridComponent,
          ],
          imports: [
            BrowserModule,
            HttpClientModule, HttpModule,
            FormsModule,
            BrowserAnimationsModule,
            MdButtonModule,
            MdProgressSpinnerModule,
            MdInputModule,
            AgGridModule.withComponents([RedComponentComponent]),
          ],
          exports: [SpinnerComponent],
          providers: [],
          bootstrap: [AppComponent]
        })
        export class AppModule {}

package.json

"ag-grid-angular": "^12.0.0",
    "ag-grid-ng2": "^8.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",

谁能帮我想出解决办法?

我可以看出你的两个问题:

  • 使用 ag-grid-angular ag-grid-ng2ag-grid-angular 是以后要使用的依赖项,它取代了 ag-grid-ng2
  • 您需要导入如下:

import {AgGridModule} from "ag-grid-angular/main";