gilbarbara / react-joyride

Create guided tours in your apps
https://react-joyride.com/
MIT License
6.62k stars 519 forks source link

Type Step returns any #949

Closed sndrem closed 9 months ago

sndrem commented 9 months ago

🐛 Bug Report

After updating to version 2.6.0, the types for the Step seems to be broken.

To Reproduce

Update to version 2.6.0

Expected behavior

I would expect the type to have type information, not just the Any type.

Here is a link to a codesandbox that does work..., so this might not be a bug, but not sure why my editor says that the type is any... https://codesandbox.io/s/wonderful-hill-z2v55g?file=/src/index.ts

I have tried to nuke the node_modules-folder and reinstalled react-joyride with the latest version.

Issues without a reproduction link are likely to stall.

Run npx envinfo --system --binaries --npmPackages react-joyride

Paste the results here:

  System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Max
    Memory: 180.23 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.9.0 - ~/.nvm/versions/node/v18.9.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.9.0/bin/yarn
    npm: 8.19.1 - ~/.nvm/versions/node/v18.9.0/bin/npm

From my editor image

From codesandbox image

sndrem commented 9 months ago

It looks as the Simplify utility from type-fest is different on my machine compared to the codesandbox example:

From my machine:

export type Simplify<
    AnyType,
    Options extends SimplifyOptions = {},
> = Flatten<AnyType> extends AnyType
    ? Flatten<AnyType, Options>
    : AnyType;

Simplify in the codesandbox example

export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
sndrem commented 9 months ago

It seems that this might have been a problem in our local setup which is a monorepo setup with Turborepo. There were other dependencies that had a dependency to type-fest with an older version. We added an explicit version to type-fest and now it works as intended.

D3X commented 8 months ago

We added an explicit version to type-fest and now it works as intended.

I don't believe that solves the problem. The types should work out of the box after installing joyride, without specifying extra dependencies manually. Either the types should be exported without the Simplify util used, or the type-fest dependency should be added as a regular dependency, not just a devDependency in package.json.

gilbarbara commented 8 months ago

Fixed in v2.6.2 Thanks