From 9ce95c61c5cef44986a0178b647a1160d1bec0bb Mon Sep 17 00:00:00 2001 From: Aron Lee Date: Sat, 15 Aug 2026 16:43:19 +0700 Subject: [PATCH] fix(ts): resolve 14 strict typecheck errors in TS variants AcidSquares passed rtA/rtB straight into renderer.render(), which takes RenderTarget | undefined, while the two lines below already assert the same values with !. Made the two render calls consistent with them. SpecularButton computed the null guard into an intermediate boolean, so narrowing did not reach pointerAngle at the use site. Inlined the same condition into the ternary; runtime behaviour is unchanged. SplitText widened tag to React.ElementType, which is a union over every intrinsic element. JSX intersects the props of a union, and the conflicting attribute types across that union collapse children, ref, style and className to never. tag is already a union of eight tags that all accept the same props, so dropping the assertion both typechecks and keeps the type more precise than the assertion did. --- src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx | 4 ++-- src/ts-default/Components/SpecularButton/SpecularButton.tsx | 4 ++-- src/ts-default/TextAnimations/SplitText/SplitText.tsx | 2 +- src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx | 4 ++-- src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx | 4 ++-- src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx b/src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx index f4c29092..29352685 100644 --- a/src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx +++ b/src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx @@ -295,13 +295,13 @@ const AcidSquares: React.FC = ({ if (blurRef.current > 0) { ensureTargets(); mu.uGrain.value = 0.0; - renderer.render({ scene: mesh, target: rtA }); + renderer.render({ scene: mesh, target: rtA! }); pu.uRadius.value = blurRef.current * 14.0; pu.tMap.value = rtA!.texture; pu.uDirection.value[0] = 1; pu.uDirection.value[1] = 0; pu.uGrain.value = 0.0; - renderer.render({ scene: postMesh, target: rtB }); + renderer.render({ scene: postMesh, target: rtB! }); pu.tMap.value = rtB!.texture; pu.uDirection.value[0] = 0; pu.uDirection.value[1] = 1; diff --git a/src/ts-default/Components/SpecularButton/SpecularButton.tsx b/src/ts-default/Components/SpecularButton/SpecularButton.tsx index 52bb336f..b0c02e4a 100644 --- a/src/ts-default/Components/SpecularButton/SpecularButton.tsx +++ b/src/ts-default/Components/SpecularButton/SpecularButton.tsx @@ -231,8 +231,8 @@ const SpecularButton = ({ const p = propsRef.current; idleAngle += p.speed * dt; - const steer = p.followMouse && pointerAngle != null && (!p.autoAnimate || proximityT > 0); - const target = steer ? pointerAngle : idleAngle; + const target = + p.followMouse && pointerAngle != null && (!p.autoAnimate || proximityT > 0) ? pointerAngle : idleAngle; const diff = ((target - angle + Math.PI * 3) % (Math.PI * 2)) - Math.PI; angle += diff * (1 - Math.exp(-dt * 7)); diff --git a/src/ts-default/TextAnimations/SplitText/SplitText.tsx b/src/ts-default/TextAnimations/SplitText/SplitText.tsx index 87da3f61..e24639fc 100644 --- a/src/ts-default/TextAnimations/SplitText/SplitText.tsx +++ b/src/ts-default/TextAnimations/SplitText/SplitText.tsx @@ -165,7 +165,7 @@ const SplitText: React.FC = ({ willChange: 'transform, opacity' }; const classes = `split-parent ${className}`; - const Tag = (tag || 'p') as React.ElementType; + const Tag = tag || 'p'; return ( diff --git a/src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx b/src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx index e736b6e8..48b6839c 100644 --- a/src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx +++ b/src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx @@ -294,13 +294,13 @@ const AcidSquares: React.FC = ({ if (blurRef.current > 0) { ensureTargets(); mu.uGrain.value = 0.0; - renderer.render({ scene: mesh, target: rtA }); + renderer.render({ scene: mesh, target: rtA! }); pu.uRadius.value = blurRef.current * 14.0; pu.tMap.value = rtA!.texture; pu.uDirection.value[0] = 1; pu.uDirection.value[1] = 0; pu.uGrain.value = 0.0; - renderer.render({ scene: postMesh, target: rtB }); + renderer.render({ scene: postMesh, target: rtB! }); pu.tMap.value = rtB!.texture; pu.uDirection.value[0] = 0; pu.uDirection.value[1] = 1; diff --git a/src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx b/src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx index 0d54c82f..c22511fe 100644 --- a/src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx +++ b/src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx @@ -236,8 +236,8 @@ const SpecularButton = ({ const p = propsRef.current; idleAngle += p.speed * dt; - const steer = p.followMouse && pointerAngle != null && (!p.autoAnimate || proximityT > 0); - const target = steer ? pointerAngle : idleAngle; + const target = + p.followMouse && pointerAngle != null && (!p.autoAnimate || proximityT > 0) ? pointerAngle : idleAngle; const diff = ((target - angle + Math.PI * 3) % (Math.PI * 2)) - Math.PI; angle += diff * (1 - Math.exp(-dt * 7)); diff --git a/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx b/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx index 78e0e39b..b5932c05 100644 --- a/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx +++ b/src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx @@ -162,7 +162,7 @@ const SplitText: React.FC = ({ willChange: 'transform, opacity' }; const classes = `split-parent overflow-hidden inline-block whitespace-normal ${className}`; - const Tag = (tag || 'p') as React.ElementType; + const Tag = tag || 'p'; return (