Handsontable 7 incompatibility

Tags: #<Tag:0x00007f8b1d9b2378>

Trying to upgrade Handsontable from 6.2.2 to 7.0.
Apparently, new version requires Typescript 3.3 (or newer). Attempt to build with TS 3.2.4 fails with:

error TS2709: Cannot use namespace ‘Handsontable’ as a type

I cannot upgrade TS to 3.3 because Angular isn’t compatible with that version. Catch 22.

I’ve got an Angular 7 app with Handsontable 7 that is build with TS 3.2.4 and it works ok.

Have you found a code line which throws this error? Does something else change when you try TS 3.3, config maybe?

Here’s the code snippet:

import * as Handsontable from ‘handsontable’;

export class TableView {
private hot: Handsontable; // this line gives error TS2709: Cannot use namespace ‘Handsontable’ as a type
}

Additional info:

I have created new Angular 7 app from scratch.
Added handsontable packages (npm).
Added “Referencing the Handsontable instance” example.
Line
hotSettings: Handsontable.GridSettings
won’t compile:
ERROR in src/app/app.component.ts(16,28): error TS2694: Namespace ‘“C:/Work/Test/Angular/my-app51/node_modules/handsontable/handsontable”’ has no exported member ‘GridSettings’.
src/app/app.component.ts(17,22): error TS2339: Property ‘helper’ does not exist on type ‘typeof import(“C:/Work/Test/Angular/my-app51/node_modules/handsontable/handsontable”)’.

Try importing Handsontable as a default: import Handsontable from 'handsontable';

Might be related to this bug: https://github.com/handsontable/handsontable/issues/4605 from 2017 that was fixed in v7.0.0.

That fixed an issue. Thanks!