WinterCore / react-text-transition

Animate your text changes
MIT License
613 stars 26 forks source link

Add support for Typescript #24

Closed zrthxn closed 3 years ago

zrthxn commented 3 years ago

An index.d.ts file can be added to make this package work with React apps in Typescript.

zrthxn commented 3 years ago

@WinterCore I've tried to copy the component into TSX to get it to work but there's always one problem https://github.com/WinterCore/react-text-transition/blob/dc050a7a31b24c5d023c804b1018c19d882f09ff/src/components/TextTransition.js#L42

This line causes an issue "Object is possibly null"

Lemme know if I can help with any of this btw

WinterCore commented 3 years ago

Hey.

This line causes an issue "Object is possibly null"

This is weird because I'm checking whether placeholderRef.current is falsy in the previous line, I'm pretty sure typescript should automatically know that it can never be undefined or null.

https://github.com/WinterCore/react-text-transition/blob/dc050a7a31b24c5d023c804b1018c19d882f09ff/src/components/TextTransition.js#L41-L42

Lemme know if I can help with any of this btw

I already started working on converting the entire thing into typescript and I'm almost done. Thanks for the offer though 🙂

WinterCore commented 3 years ago

Resolved in 1.3.0