react-tiny-link icon indicating copy to clipboard operation
react-tiny-link copied to clipboard

Typescript definitions planned for release any soon?

Open vladimirmoushkov opened this issue 5 years ago • 16 comments

Thank you!

vladimirmoushkov avatar Mar 23 '19 07:03 vladimirmoushkov

Hi @vladimirmoushkov .Thanks for the issue, I m willing to release Typescript definitions too , As I m not that fluent in TypeScript I may need some one's help. I do appreciate if you could help me to migrate to typescript.

Thanks

winhtaikaung avatar Mar 25 '19 14:03 winhtaikaung

I have created a #2.

Still failing to active the full functionality. Could you help me with fixing the parsing error?

vladimirmoushkov avatar Mar 29 '19 13:03 vladimirmoushkov

Sure @vladimirmoushkov . Can you please check the comments from #2 before we proceed? Thanks

winhtaikaung avatar Mar 30 '19 09:03 winhtaikaung

Btw, The library package produced is quite big. I did ran webpack-bundle-analyzer and found out that the most of it comes from parse5 (unused library) and lodash (used just for isEmpty function).

Removing these could improve the library size footprint.

Are you interested in me doing this?

On Sat, Mar 30, 2019 at 11:05 AM Win Htaik Aung [email protected] wrote:

Sure @vladimirmoushkov https://github.com/vladimirmoushkov . Can you please check the comments from #2 https://github.com/winhtaikaung/react-tiny-link/pull/2 before we proceed? Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/winhtaikaung/react-tiny-link/issues/1#issuecomment-478223378, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPfoGeWknUlYCXyHG6tAd_JmZYdTAabks5vbyjygaJpZM4cEx6h .

vladimirmoushkov avatar Mar 30 '19 17:03 vladimirmoushkov

Sure please feel free to improve @vladimirmoushkov

winhtaikaung avatar Apr 01 '19 06:04 winhtaikaung

Have a look at the latest commit.

  • substituted parse5/ cheerio with QuerySelector https://caniuse.com/#search=queryselector.
  • substituted axis with Fetch https://caniuse.com/#search=fetch. Warning, no IE support, but Edge works. I believe if you insist on internet explorer support this Axios will still need to be eliminated by lighter substitute.
  • removed image|audio|video-extensions and path npm packages dependancy by simple mimeType check (see utils.ts).
  • added webpack-bundle-analyzer as part of the build process. You will see now on npm run start and npm run build:lib run summary of the dependancies sizes. Side note - you will see *sockjs *library inclusions in the bundle for the npm run start as it is included by the hot reload process of webpack dev server. However its s not part of the final product resulted by npm run build:lib.
  • please see my changes to the ScrapperImage, I did not understand the need of image selection as if data is html if detected that it is image before that so removed it.

I believe those changes worth the inclusion in the next release. The library is now uncompressed 270 kb (of which > 100 kb belong to React) comparing to 1.16 MB.

Regards, Vladimir Moushkov

On Mon, Apr 1, 2019 at 9:27 AM Win Htaik Aung [email protected] wrote:

Sure please feel free to improve @vladimirmoushkov https://github.com/vladimirmoushkov

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/winhtaikaung/react-tiny-link/issues/1#issuecomment-478451994, or mute the thread https://github.com/notifications/unsubscribe-auth/AUPfoLvdhpnJNF6DjgQtbkn10AL6uN03ks5vcabqgaJpZM4cEx6h .

vladimirmoushkov avatar Apr 01 '19 10:04 vladimirmoushkov

@all-contributors please add @vladimirmoushkov for code

winhtaikaung avatar Apr 02 '19 13:04 winhtaikaung

@winhtaikaung

I've put up a pull request to add @vladimirmoushkov! :tada:

allcontributors[bot] avatar Apr 02 '19 13:04 allcontributors[bot]

Thank you @vladimirmoushkov for you help.Released the react-tiny-link typescript version 1.0.0 to npm.

Cheers 🍻

winhtaikaung avatar Apr 02 '19 13:04 winhtaikaung

@winhtaikaung,

I feel like I'm missing something really obvious, but I'm not able to use this package in TypeScript at all.

There is no d.ts file in the react-tiny-link/lib folder in node_modules:

image

There is no @types/react-tiny-link in NPM:

image

And I am not able to import the module as specified in the docs:

image

Please help 🙏

devuxer avatar Oct 06 '20 05:10 devuxer

Follow-up:

It looks like the main problem is with "typings": "src/lib/index.d.ts", in package.json. When I install the package, there is no lib folder inside src, so typings cannot be found. If I remove "/lib", it seems to work.

That said, there seem to be other problems which prevent the TypeScript compiler from succeeding, such as missing types for styled-components.

devuxer avatar Oct 06 '20 18:10 devuxer

Follow-up:

It looks like the main problem is with "typings": "src/lib/index.d.ts", in package.json. When I install the package, there is no lib folder inside src, so typings cannot be found. If I remove "/lib", it seems to work.

That said, there seem to be other problems which prevent the TypeScript compiler from succeeding, such as missing types for styled-components.

Hey @devuxer thanks for reporting I will take alook,

winhtaikaung avatar Oct 08 '20 11:10 winhtaikaung

Any update the issue? Please help! Waiting for the TypeScript version :)

dong8898 avatar Aug 14 '21 10:08 dong8898

Not usable in typescript. Any updates?

masroore avatar Jul 07 '22 17:07 masroore

Any new updates on using this with typescript?

OhYello avatar Mar 05 '23 03:03 OhYello

Hi, I'm facing the same issue here. It's working fine when I used npm run dev, but it's showing error when I want to build the app.

ravmhmmd avatar Oct 20 '23 18:10 ravmhmmd