Definitelytyped: error TS2503: Cannot find namespace 'DataTables'

Created on 18 Apr 2018  路  5Comments  路  Source: DefinitelyTyped/DefinitelyTyped

While Running ng test' got this error

Please provide a fix for the same

* @types / datatables.net version 1.10.9* package.json module

Most helpful comment

To solve this error they must change in the package.json the dependency: "angular-datatables": "^ 0.6.3", by "angular-datatables": "^ 6.0.0".

then update your package.json with the npm install command

Note: sorry for my level of English

All 5 comments

Yeah I am having the same issue too

Try to import DataTablesModule in your test (spec). It helped me.

import { DataTablesModule } from 'angular-datatables';

 beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ MyComponent ], imports: [ DataTablesModule ]
    })
    .compileComponents();
  }));

To solve this error they must change in the package.json the dependency: "angular-datatables": "^ 0.6.3", by "angular-datatables": "^ 6.0.0".

then update your package.json with the npm install command

Note: sorry for my level of English

Thank you so much !

@kkazmierczak is right by importing DataTablesModule it worked! Thanks

Was this page helpful?
0 / 5 - 0 ratings