handsontable / handsontable

JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡

Home Page:https://handsontable.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Index.d.ts does not export HotTableClass thus breaking React refs

MattChowski opened this issue · comments

Describe the bug

Hey all,

I wanted to use refs to access the instance of the HotTable, however, for Typescript to work, I need the HotTableClass inside useRef<HotTableClass | null>(null) in order to have everything typed correctly. Currently the index.d.ts file does not export HotTableClass and this feels like a missed/forgotten export by mistake.

When trying to access the hotInstance of the current ref property this is what I get for the lack of typing added to useRef:

image

This is the current index.d.ts in the latest version

export * from './hotTable';
export * from './types';
export * from './baseEditorComponent';
export { default } from './hotTable';

expected:

export * from './hotTable';
export * from './hotTableClass';
export * from './types';
export * from './baseEditorComponent';
export { default } from './hotTable';

Current workaround:

Add type like this: import { HotTableClass } from "@handsontable//react/hotTableClass";, note the double slashes which look ugly

Thank you in advance for any clarification/suggestion

Video/Screenshots

No response

Provide a link to the demo with the bug reproduction

No response

Handsontable version

14.1.0

Framework version

No response

Your environment

Chrome

Thanks for reporting @MattChowski, I will look at this.

This will be resolved with our next release, I will let you know when that happens.

Hi @MattChowski

Just wanted to let you know that we released Handsontable 14.2 including the fix for this issue. Please check it and let me know if the issue is gone.