Skip to content

[bug]: base scroll-area ships unused import * as React (breaks tsc with noUnusedLocals) #11274

Description

@AlexanderMatveev

Describe the bug

The Base UI scroll-area registry component includes:

import * as React from "react"

but never uses the React namespace (types come from ScrollAreaPrimitive.*.Props, JSX uses the automatic runtime).

With a typical Vite + React TypeScript config ("jsx": "react-jsx", "noUnusedLocals": true), tsc fails:

src/components/ui/scroll-area.tsx: error TS6133: 'React' is declared but its value is never read.

The unused import is present in the published registry and in the source of truth:

Expected: either remove the unused import, or use React only where needed (e.g. React.ComponentProps<...>), so generated files typecheck under noUnusedLocals.

Affected component/components

scroll-area (base / base-luma)

How to reproduce

  1. Create a Vite + React + TypeScript app with "noUnusedLocals": true in tsconfig.
  2. Init shadcn with a Base style (e.g. base-luma) and rsc: false.
  3. Run npx shadcn@latest add scroll-area.
  4. Run tsc -b (or the project's typecheck / build that invokes tsc).
  5. See TS6133: 'React' is declared but its value is never read.

Codesandbox/StackBlitz link

N/A — reproduction is the stock registry file; no app-specific code required. Diff vs a fixed version is removing the unused React import (CLI already strips "use client" when rsc: false).

Logs

src/components/ui/scroll-area.tsx:1:13 - error TS6133: 'React' is declared but its value is never read.

1 import * as React from "react"
              ~~~~~

Found 1 error.

System Info

shadcn style: base-luma (Base UI)
TypeScript: noUnusedLocals=true, jsx=react-jsx
Package manager: yarn / npm / pnpm (any)
Framework: Vite + React

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions