reactour icon indicating copy to clipboard operation
reactour copied to clipboard

Allow type augmentation

Open Vishal1419 opened this issue 1 year ago • 2 comments

As of now, for me, v3.1.4 (latest) is not working, gives me some compilation errors, so I using these versions:

"@reactour/tour": "2.10.3",
"resolutions": {
    "@reactour/utils": "0.3.0",
    "@reactour/popover": "0.4.1",
    "@reactour/mask": "0.5.1"
  }

My application is context aware, so I need a key property on StepType interface. I tried to augment types by creating @reactour.d.ts Here is its contents:

import { StepType as _StepType } from '@reactour/tour';

declare module '@reactour/tour' {
  type StepType = _StepType & {
    key: string;
  }
}

Wherever libary uses StepType interface, I expect it to have key property now, but that's not the case. e.g.

const { steps } = useTour();
steps[0].key   <---- throws an error: Property 'key' does not exist on type 'StepType'

So, I guess, typings of this library has some issues. It will be awesome if it is fixed in a near future release.

And thanks for a great library!

Vishal1419 avatar Oct 05 '22 07:10 Vishal1419