fix(ts): use type-only imports in TS variants (fixes TS1484 in stock Vite react-ts apps) - #1018
fix(ts): use type-only imports in TS variants (fixes TS1484 in stock Vite react-ts apps)#1018noron12234 wants to merge 2 commits into
Conversation
The TS-CSS and TS-TW variants shipped through the registry import type-only bindings (ReactNode, FC, CSSProperties, Transition, IUniform, RootState, ThreeEvent, ...) as value imports. TypeScript's own `--template react-ts` scaffold enables `verbatimModuleSyntax`, so every one of these is a hard TS1484 compile error the moment someone installs a TS variant into a stock Vite app. Adds the inline `type` modifier at 132 specifiers across 83 files, matching the style already used elsewhere in the same imports (e.g. RotatingText already writes `type VariantLabels`). No runtime or type semantics change.
|
Follow-up: I understated the impact in the description. For at least one component this is not a
Production build, stock Vite React-TS app, $ npx vite build
error during build:
Build failed with 1 error:
[MISSING_EXPORT] "WebGLRendererParameters" is not exported by "node_modules/three/build/three.module.js".
4 │ import { ACESFilmicToneMapping, ..., WebGLRenderer, WebGLRendererParameters } from "three";
│ ╰───────────── Missing exportDev server, same app, measured with Playwright:
So Why this one and not Nothing changes in the diff; the |
There was a problem hiding this comment.
Pull request overview
This pull request fixes TypeScript build errors (TS1484) in the TypeScript component variants by converting type-only named imports (from react, motion/react, three, and @react-three/fiber) into explicit type imports using the inline type modifier, aligning with verbatimModuleSyntax defaults in stock Vite React-TS projects.
Changes:
- Updated TS variant files to use
type-only import specifiers for bindings that are types (e.g.Transition,Variants,RootState,IUniform,JSX, etc.). - Applied the same mechanical import fix consistently across both TS variants (
ts-defaultandts-tailwind), with only formatting rewraps where needed.
Reviewed changes
Copilot reviewed 83 out of 83 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/ts-tailwind/TextAnimations/VariableProximity/VariableProximity.tsx | Converts React type imports to inline type specifiers. |
| src/ts-tailwind/TextAnimations/TextType/TextType.tsx | Marks ElementType as type-only in React import. |
| src/ts-tailwind/TextAnimations/Shuffle/Shuffle.tsx | Marks JSX as type-only in React import. |
| src/ts-tailwind/TextAnimations/ScrollReveal/ScrollReveal.tsx | Marks ReactNode/RefObject as type-only in React import. |
| src/ts-tailwind/TextAnimations/ScrollFloat/ScrollFloat.tsx | Marks ReactNode/RefObject as type-only in React import. |
| src/ts-tailwind/TextAnimations/RotatingText/RotatingText.tsx | Marks Transition as type-only in motion/react import. |
| src/ts-tailwind/TextAnimations/GradientText/GradientText.tsx | Marks ReactNode as type-only in React import. |
| src/ts-tailwind/TextAnimations/GlitchText/GlitchText.tsx | Marks FC/CSSProperties as type-only in React import. |
| src/ts-tailwind/TextAnimations/CurvedLoop/CurvedLoop.tsx | Marks FC/PointerEvent as type-only in React import. |
| src/ts-tailwind/TextAnimations/CircularText/CircularText.tsx | Marks Transition as type-only in motion/react import. |
| src/ts-tailwind/TextAnimations/BlurText/BlurText.tsx | Marks Transition/Easing as type-only in motion/react import. |
| src/ts-tailwind/Components/Stepper/Stepper.tsx | Marks React and Motion type imports as type-only. |
| src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx | Marks React DOM/types imports as type-only. |
| src/ts-tailwind/Components/PixelCard/PixelCard.tsx | Marks JSX as type-only in React import. |
| src/ts-tailwind/Components/OptionWheel/OptionWheel.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Components/ModelViewer/ModelViewer.tsx | Marks FC as type-only in React import. |
| src/ts-tailwind/Components/LineSidebar/LineSidebar.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Components/InfiniteMenu/InfiniteMenu.tsx | Marks FC/MutableRefObject as type-only in React import. |
| src/ts-tailwind/Components/FluidGlass/FluidGlass.tsx | Marks ReactNode/ThreeElements as type-only imports. |
| src/ts-tailwind/Components/DecayCard/DecayCard.tsx | Marks ReactNode as type-only in React import. |
| src/ts-tailwind/Components/Carousel/Carousel.tsx | Marks PanInfo/JSX as type-only imports. |
| src/ts-tailwind/Components/CardSwap/CardSwap.tsx | Marks ReactElement/ReactNode/RefObject as type-only imports. |
| src/ts-tailwind/Components/AnimatedList/AnimatedList.tsx | Marks React event/node types as type-only imports. |
| src/ts-tailwind/Backgrounds/Waves/Waves.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Backgrounds/Silk/Silk.tsx | Marks RootState/IUniform as type-only imports. |
| src/ts-tailwind/Backgrounds/Hyperspeed/Hyperspeed.tsx | Marks FC as type-only in React import. |
| src/ts-tailwind/Backgrounds/GridMotion/GridMotion.tsx | Marks FC/ReactNode as type-only in React import. |
| src/ts-tailwind/Backgrounds/Dither/Dither.tsx | Marks ThreeEvent as type-only in @react-three/fiber import. |
| src/ts-tailwind/Backgrounds/Beams/Beams.tsx | Marks FC/ReactNode as type-only in React import. |
| src/ts-tailwind/Backgrounds/Ballpit/Ballpit.tsx | Marks WebGLRendererParameters as type-only in three import. |
| src/ts-tailwind/Animations/Strands/Strands.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Animations/StickerPeel/StickerPeel.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Animations/ShapeBlur/ShapeBlur.tsx | Marks FC as type-only in React import. |
| src/ts-tailwind/Animations/PixelTransition/PixelTransition.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Animations/PixelTrail/PixelTrail.tsx | Marks CanvasProps/ThreeEvent as type-only in @react-three/fiber import. |
| src/ts-tailwind/Animations/OrbitImages/OrbitImages.tsx | Marks ReactNode as type-only in React import. |
| src/ts-tailwind/Animations/MagnetLines/MagnetLines.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-tailwind/Animations/Magnet/Magnet.tsx | Marks ReactNode/HTMLAttributes as type-only in React import. |
| src/ts-tailwind/Animations/ImageTrail/ImageTrail.tsx | Marks JSX as type-only in React import. |
| src/ts-tailwind/Animations/GradualBlur/GradualBlur.tsx | Marks CSSProperties/PropsWithChildren as type-only in React import. |
| src/ts-tailwind/Animations/ElectricBorder/ElectricBorder.tsx | Marks CSSProperties/ReactNode as type-only in React import. |
| src/ts-tailwind/Animations/Crosshair/Crosshair.tsx | Marks RefObject as type-only in React import. |
| src/ts-default/TextAnimations/VariableProximity/VariableProximity.tsx | Converts React type imports to inline type specifiers. |
| src/ts-default/TextAnimations/TrueFocus/TrueFocus.tsx | Marks RefObject as type-only in React import. |
| src/ts-default/TextAnimations/TextType/TextType.tsx | Marks ElementType as type-only in React import. |
| src/ts-default/TextAnimations/ScrollReveal/ScrollReveal.tsx | Marks ReactNode/RefObject as type-only in React import. |
| src/ts-default/TextAnimations/ScrollFloat/ScrollFloat.tsx | Marks ReactNode/RefObject as type-only in React import. |
| src/ts-default/TextAnimations/RotatingText/RotatingText.tsx | Marks Transition as type-only in motion/react import. |
| src/ts-default/TextAnimations/GradientText/GradientText.tsx | Marks ReactNode as type-only in React import. |
| src/ts-default/TextAnimations/GlitchText/GlitchText.tsx | Marks FC/CSSProperties as type-only in React import. |
| src/ts-default/TextAnimations/CurvedLoop/CurvedLoop.tsx | Marks FC/PointerEvent as type-only in React import. |
| src/ts-default/TextAnimations/CircularText/CircularText.tsx | Marks Transition as type-only in motion/react import. |
| src/ts-default/TextAnimations/BlurText/BlurText.tsx | Marks Transition as type-only in motion/react import. |
| src/ts-default/Components/Stepper/Stepper.tsx | Marks React/Motion type imports as type-only. |
| src/ts-default/Components/SpecularButton/SpecularButton.tsx | Marks React DOM/types imports as type-only. |
| src/ts-default/Components/PixelCard/PixelCard.tsx | Marks JSX as type-only in React import. |
| src/ts-default/Components/OptionWheel/OptionWheel.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Components/ModelViewer/ModelViewer.tsx | Marks FC as type-only in React import. |
| src/ts-default/Components/LineSidebar/LineSidebar.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Components/InfiniteMenu/InfiniteMenu.tsx | Marks FC/MutableRefObject as type-only in React import. |
| src/ts-default/Components/FluidGlass/FluidGlass.tsx | Marks ReactNode/ThreeElements as type-only imports. |
| src/ts-default/Components/DecayCard/DecayCard.tsx | Marks ReactNode as type-only in React import. |
| src/ts-default/Components/Carousel/Carousel.tsx | Marks PanInfo as type-only in motion/react import. |
| src/ts-default/Components/CardSwap/CardSwap.tsx | Marks ReactElement/ReactNode/RefObject as type-only imports. |
| src/ts-default/Components/AnimatedList/AnimatedList.tsx | Marks React event/node types as type-only imports. |
| src/ts-default/Backgrounds/Waves/Waves.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Backgrounds/Silk/Silk.tsx | Marks RootState/IUniform as type-only imports. |
| src/ts-default/Backgrounds/Hyperspeed/Hyperspeed.tsx | Marks FC as type-only in React import. |
| src/ts-default/Backgrounds/GridMotion/GridMotion.tsx | Marks FC/ReactNode as type-only in React import. |
| src/ts-default/Backgrounds/Dither/Dither.tsx | Marks ThreeEvent as type-only in @react-three/fiber import. |
| src/ts-default/Backgrounds/Beams/Beams.tsx | Marks FC/ReactNode as type-only in React import. |
| src/ts-default/Backgrounds/Ballpit/Ballpit.tsx | Marks WebGLRendererParameters as type-only in three import. |
| src/ts-default/Animations/Strands/Strands.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Animations/StickerPeel/StickerPeel.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Animations/PixelTransition/PixelTransition.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Animations/PixelTrail/PixelTrail.tsx | Marks CanvasProps/ThreeEvent as type-only in @react-three/fiber import. |
| src/ts-default/Animations/OrbitImages/OrbitImages.tsx | Marks ReactNode as type-only in React import. |
| src/ts-default/Animations/MagnetLines/MagnetLines.tsx | Marks CSSProperties as type-only in React import. |
| src/ts-default/Animations/Magnet/Magnet.tsx | Marks ReactNode/HTMLAttributes as type-only in React import. |
| src/ts-default/Animations/ImageTrail/ImageTrail.tsx | Marks JSX as type-only in React import. |
| src/ts-default/Animations/GradualBlur/GradualBlur.tsx | Marks CSSProperties/PropsWithChildren as type-only in React import. |
| src/ts-default/Animations/ElectricBorder/ElectricBorder.tsx | Marks CSSProperties/ReactNode as type-only in React import. |
| src/ts-default/Animations/Crosshair/Crosshair.tsx | Marks RefObject as type-only in React import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
public/r/*.json embeds the component source verbatim and is what the jsrepo CLI writes into a user's project, so fixing only src/ left the shipped payload with the value imports intact — including Ballpit's WebGLRendererParameters, which is the one that makes rolldown fail the build outright. Regenerated with `npm run registry:build`; 83 entries change, all TS variants.
|
Pushed
Regenerated with |
Prior art
This is the same fix you already merged twice, applied to everything that is still left:
fix-types-on-RotatingText-ts(merged) — fixedVariantsin RotatingTextHTMLMotionPropsin DecryptedText, filed as [BUG]: text-animations/decrypted-text, need type keyword #853Both were one-component patches.
tscsays 83 files still have the same defect, so this PRclears the whole class in one pass instead of waiting for 83 more bug reports.
The problem
The TS variants (
TS-CSS/TS-TW) import type-only bindings as value imports:verbatimModuleSyntaxis on by default in the scaffold TypeScript itself generates:npm create vite@latest -- --template react-tswrites it intotsconfig.app.json.So for anyone installing a TS variant into a stock Vite app, these are hard
TS1484build errors, not warnings.Reproduction (before)
After
tsc --noEmit --verbatimModuleSyntaxin this repoTS1484react-tstemplate)TS2322/TS2745/TS18047)vite buildhereThe change
Adds the inline
typemodifier at 132 specifiers across 83 files — the same style already usedin these very import statements. Nothing else: the diff is 100%
typeinsertions plus Prettierrewrapping the 4 lines that crossed the print width.
Affected bindings:
ReactNodeFCCSSPropertiesRefObjectMutableRefObjectHTMLAttributesReactElementPropsWithChildrenJSXElementTypeMouseEventHandlerUIEventPointerEvent(react) ·
TransitionVariantsEasing(motion) ·IUniformWebGLRendererParameters(three) ·RootStateThreeEventThreeElementsCanvasProps(@react-three/fiber).On the "all 4 variants" rule
Only the two TS variants are touched, because
JS-CSS/JS-TWhave no type imports to fix —the JS sources are byte-identical before and after. Every affected component is updated in both
TS variants, never one alone.
Verification
npx tsc --noEmit --verbatimModuleSyntax→TS1484count 132 → 0; the 10 pre-existing errors are unchanged (this PR does not claim to fix those).npx vite buildpasses.Silk+RotatingTextin a stock Vite React-TS app: WebGL canvas mounts, text rotates, zero console errors (only an unrelatedTHREE.Clockdeprecation notice from three itself).type-insertion changes.Optional follow-up
Setting
"verbatimModuleSyntax": truein the roottsconfig.jsonwould catch regressions in-editor.Left out of this PR on purpose so the diff stays purely mechanical — happy to add it if you want it.