Skip to content

fix: unify @types/react versions across workspace#3020

Open
StarbirdTech wants to merge 1 commit intospacedriveapp:mainfrom
StarbirdTech:fix/unify-react-types
Open

fix: unify @types/react versions across workspace#3020
StarbirdTech wants to merge 1 commit intospacedriveapp:mainfrom
StarbirdTech:fix/unify-react-types

Conversation

@StarbirdTech
Copy link
Contributor

@StarbirdTech StarbirdTech commented Feb 8, 2026

The npm:types-react@rc aliases from the React 19 RC phase and loose ^19.0.0 ranges were still in four frontend packages. PR #3011 added @types/react: ~19.1.10 to root devDependencies and overrides, but explicit child devDependencies take precedence — so four copies coexisted (19.0.0-rc.1 and 19.1.17), and TypeScript treated their ReactNode types as incompatible. Also adds a vite-env.d.ts that brings vite/client type declarations (.png, .svg, .ogg, .mp3, etc.) into the tauri typecheck scope and declares the ReactComponent SVG export that SVGR expects.

Changes

  • apps/tauri, packages/interface, packages/ui — replace npm:types-react@rc aliases with ~19.1.10
  • apps/web — replace ^19.0.0 range with ~19.1.10
  • apps/tauri/src/vite-env.d.ts — references vite/client for asset module types and adds the ReactComponent named export for *.svg (SVGR convention that vite/client doesn't cover)
  • bun.lockb — regenerated, 37KB smaller with deduplication

Impact

Typecheck errors: 1,119 → 428 (~62% reduction). All 1,119 errors were pre-existing on main — ~687 were missing asset module declarations (.png, .svg, etc.) now resolved by the vite/client reference, and the rest were duplicate-@types/react fallout. The remaining 428 are real project-level issues (unused vars, TailwindFactory types, broken imports).

Verified

  • Single @types/react@19.1.17 copy at root; zero nested copies
  • Zero TS2786 ("cannot be used as JSX component") errors
  • Tauri Vite build passes
  • Pre-existing apps/web build failure unchanged (unrelated @sd/interface/platform export)

Replace outdated `npm:types-react@rc` aliases (19.0.0-rc.1) with stable
`~19.1.10` in packages/interface, packages/ui, and apps/tauri. Also pin
apps/web from the loose `^19.0.0` to `~19.1.10`. This eliminates four
duplicate copies of @types/react that caused ~100 false-positive JSX
component errors.

Add vite-env.d.ts with an SVG module declaration extending vite/client
with the SVGR ReactComponent export used by packages/assets.

Reduces typecheck errors from ~1,221 to ~428 (all remaining are real
project-level issues).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
import type { FC, SVGProps } from 'react';
const src: string;
export default src;
export const ReactComponent: FC<SVGProps<SVGSVGElement>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches common SVGR typings, but you may want to include the optional title prop to avoid needless friction when callers pass it.

Suggested change
export const ReactComponent: FC<SVGProps<SVGSVGElement>>;
export const ReactComponent: FC<SVGProps<SVGSVGElement> & { title?: string }>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant