gilbarbara / react-joyride

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

import error in typescript project #989

Closed DawitAskabe closed 5 months ago

DawitAskabe commented 5 months ago

🐛 Bug Report

import error in typescript project

ERROR in ./node_modules/react-joyride/dist/index.mjs 214:16-28
Can't import the named export 'createPortal' (imported as 'createPortal') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 241:15-29
Can't import the named export 'isValidElement' (imported as 'isValidElement') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 982:34-49
Can't import the named export 'Component' (imported as 'React') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 1070:34-53
Can't import the named export 'createElement' (imported as 'React') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 1082:34-53
Can't import the named export 'createElement' (imported as 'React') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 1092:24-43
Can't import the named export 'createElement' (imported as 'React') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 1093:24-43
Can't import the named export 'createElement' (imported as 'React') from default-exporting module (only default export is available)

ERROR in ./node_modules/react-joyride/dist/index.mjs 1107:25-45
Can't import the named export 'createElement' (imported as 'React2') from default-exporting module (only default export is available)

ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts
[tsl] ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts(59,36)
      TS1005: '?' expected.

ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts
[tsl] ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts(60,49)
      TS1005: '?' expected.

ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts
[tsl] ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts(64,50)
      TS1005: '?' expected.

ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts
[tsl] ERROR in /Users/dave/Documents/workspace/proj-1/node_modules/react-joyride/node_modules/type-fest/source/join.d.ts(65,36)
      TS1005: '?' expected.

To Reproduce

import joyride as follows import Joyride from 'react-joyride';

Expected behavior

shouldn't get errors

Link to repl or repo (highly encouraged)

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

Paste the results here:


  System:
    OS: macOS 13.6.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 519.71 MB / 32.00 GB
    Shell: 3.2.57 - /bin/sh
  Binaries:
    Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.20.2/bin/npm
    Watchman: 2023.12.04.00 - /usr/local/bin/watchman
  npmPackages:
    react-joyride: ^2.7.2 => 2.7.2 
gilbarbara commented 5 months ago

Hey @DawitAskabe

You must be running old dependencies in your app or a misconfigured tsconfig. Check the demo to see how it's working with Typescript without problems.

DawitAskabe commented 5 months ago

here are changes i had to make to get it to build in my project:

react-joyride > 2.5.5 starts using typescript 5.2.2 ; which breaks other react libs. react-joyride 2.5.5 uses typescript 4.9.5 - upgraded my project accordingly.

dependencies

image

devdependencies image

pccai commented 2 months ago

"react-joyride": "2.5.5",

It works for me.