undoRedo.doneActions in React?

Tags: #<Tag:0x00007f0b0ea273d8>

Hi

I’m want to get the doneActions array from my table to see how many undo actions are available. I do this:

const hotRef = useRef<HotTable>(null);
<HotTable ref={hotRef} />

// @ts-ignore
hotRef.current.__hotInstance.undoRedo.doneActions

But it is not exposed in the Typescript types… So I have to use ts-ignore to omit the type error.

Is this the best way to get the doneActions? Are the types wrong or intentionally hiding doneActions?

I’m unable to create a codesandbox example, it does not like useRef for some reason…

Thanks!

Hi @mottosson

This method isn’t accessible through our public API, and that’s the reason why the types aren’t recognized. Currently, we don’t have any other method that would let you get this kind of information so if bypassing type checking isn’t a problem for you I would stick with that solution.