Closed bhr closed 3 years ago
I think that the documentation should contain at least minimal examples of using this library with TypeScript, since I couldn't even run an example from the documentation 😕
This issue is a duplicate of #2748 . As of today TS doesn't support aliasing of types or messing with their resolution.
@on3dd We have a dedicated page for TypeScript in our documentation. Just checked and those examples listed there work and compile via the official tsc compiler.
@bhr - I don't suppose you worked out to get around this error have you? I've just hit the same thing when trying to use a SwitchTransition
and can't resolve it. Our tsconfig is configured as per the tsconfig referenced by @marvinhagemeister, and the workaround suggested in issue #2748 just introduces new errors for me.
@seddy We just ignore the ts-error.
<SwitchTransition mode="out-in">
{/* @ts-expect-error: Let's ignore a single compiler error like this unreachable code */}
<CSSTransition
key={currentPath}
timeout={400}
classNames={pageDirection}
nodeRef={nodeRef}
addEndListener={() => {
nodeRef.current?.addEventListener('transitionend', resetAnimating(), false);
}}
>
....
</CSSTransition>
</SwitchTransition>
Thanks @bhr! That has worked for us too; seems reasonable given the outstanding issue in #2748
Reproduction
I'm trying to build a nextjs project that is using react + preact along with react-transition-group.
Running in dev mode works. Building the project fails though given the following error:
Build Error
Code Sample
Codesandbox Preact
Codesandbox
Codesandbox React
For comparison, I created a react-only version that doesn't highlight the error: Codesandbox
Project setup
The actual project setup:
tsconfig.json
package.json
Steps to reproduce
yarn run build
Expected Behavior
Build to succeed
Actual Behavior
Build fails with error above