alvarotrigo / react-fullpage

Official React.js wrapper for fullPage.js https://alvarotrigo.com/react-fullpage/
GNU General Public License v3.0
1.29k stars 178 forks source link

Added Typescript ( react-fullpage.d.ts ) to the dist folder (PLEASE ACCEPT) #292

Closed AbobkerElaghel closed 2 years ago

AbobkerElaghel commented 2 years ago

Please accept, Some (IAAS) Infrastructure as a service platforms build the projects on every push, it fails the build process because of a typescript error for everyone that uses typescript with React fullPage.

alvarotrigo commented 2 years ago

Is dist the right folder for it? 🤔

AbobkerElaghel commented 2 years ago

Yes, it is, when pasting the file there all typescript errors disappear. as seen below, I had to write a copy command to copy the types file to its destination (dist). and run it right after npm i 1 2

alvarotrigo commented 2 years ago

I think a better place can be in a folder called ./types on the root folder. Same as in this repo.

If you can make the change I'll merge it.

AbobkerElaghel commented 2 years ago

When trying to fix the issue about 2 weeks ago, I tried lots of places, creating a types dir and putting the file inside didn't work, unfortunately. And to make sure, I just deleted it from dist and created a types dir and put the file inside, it did not work, gives a typescript error and is not compiling.

The one that worked is inside the dist location.

alvarotrigo commented 2 years ago

Shouldn't you be importing it on your code?

AbobkerElaghel commented 2 years ago

If u are talking about the types file, No. it should import the types automatically like all other repos. your only concern is to import the package to use it.

alvarotrigo commented 2 years ago

Have you tried renaming it to for example types/index.d.ts instead? It might be related with this?

We'd also have to add it on the package.json file as "types": "types/index.d.ts", See an example here.

AbobkerElaghel commented 2 years ago

Yap, This fixed it.

AbobkerElaghel commented 2 years ago

I'll cancel this pull requirest and do another one with the modifications.

AbobkerElaghel commented 2 years ago

https://github.com/alvarotrigo/react-fullpage/pull/293/files

patcheco1001 commented 2 years ago

Thank you @AbobkerElaghel for your works and effort. Could you please make the Item object exportable ? This object is not just used internally as you know but also returned in the listeners onLeave, afterLoad and afterSlideLoad It's a quick fix : replace type Item with export type Item

alvarotrigo commented 2 years ago

@patcheco1001 done! I just need to figure out now why the codesandbox is not working so I can merge this. If you can give me a hand here I will appreciate it! 👍 https://codesandbox.io/s/m34yq5q0qx