Skip to content

[BUG]: TypeScript variants fail strict typecheck with 14 errors #1041

Description

@dinhnguyenminhhoang

Describe the issue

After a clean installation from the current main branch, running TypeScript in strict mode reports 14 errors across six TS-CSS and TS-TW variant files.

Affected components:

  • AcidSquares (ts-default and ts-tailwind)
  • SpecularButton (ts-default and ts-tailwind)
  • SplitText (ts-default and ts-tailwind)

The repository does not currently provide a typecheck script, so I ran the installed TypeScript compiler directly using the repository's existing
tsconfig.json.

Expected behavior

All TypeScript component variants should compile successfully with the repository's strict TypeScript configuration.

Actual behavior

TypeScript exits with 14 errors, including:

  • RenderTarget | null being passed where RenderTarget | undefined is expected
  • A possibly-null target being accessed
  • The polymorphic SplitText element resolving its props and children to never

Environment

  • Commit: c7109dccb42e06592d1d9bc50bc87204697240e2
  • Branch: main
  • Node.js: v24.19.0
  • npm: 11.17.0
  • OS: Windows 11 (10.0.26100)

Reproduction Link

No response

Steps to reproduce

  1. Clone the repository and check out the affected commit:

    git clone https://github.com/DavidHDev/react-bits.git
    cd react-bits
    git checkout c7109dccb42e06592d1d9bc50bc87204697240e2
    
  2. Install dependencies from the lockfile:

    npm ci

  3. Run TypeScript using the repository configuration:

    npm exec tsc -- --noEmit

  4. TypeScript reports 14 errors:

    src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx(298,40): error TS2322: Type 'RenderTarget | null' is not assignable to type 'RenderTarget |
    undefined'.
    src/ts-default/Backgrounds/AcidSquares/AcidSquares.tsx(304,44): error TS2322: Type 'RenderTarget | null' is not assignable to type 'RenderTarget |
    undefined'.

    src/ts-default/Components/SpecularButton/SpecularButton.tsx(236,22): error TS18047: 'target' is possibly 'null'.

    src/ts-default/TextAnimations/SplitText/SplitText.tsx(171,8): error TS2745: This JSX tag's 'children' prop expects type 'never' which requires multiple
    children, but only a single child was provided.
    src/ts-default/TextAnimations/SplitText/SplitText.tsx(171,12): error TS2322: Type 'RefObject<HTMLParagraphElement | null>' is not assignable to type
    'never'.
    src/ts-default/TextAnimations/SplitText/SplitText.tsx(171,22): error TS2322: Type 'CSSProperties' is not assignable to type 'never'.
    src/ts-default/TextAnimations/SplitText/SplitText.tsx(171,36): error TS2322: Type 'string' is not assignable to type 'never'.

    src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx(297,40): error TS2322: Type 'RenderTarget | null' is not assignable to type 'RenderTarget |
    undefined'.
    src/ts-tailwind/Backgrounds/AcidSquares/AcidSquares.tsx(303,44): error TS2322: Type 'RenderTarget | null' is not assignable to type 'RenderTarget |
    undefined'.

    src/ts-tailwind/Components/SpecularButton/SpecularButton.tsx(241,22): error TS18047: 'target' is possibly 'null'.

    src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx(168,8): error TS2745: This JSX tag's 'children' prop expects type 'never' which requires
    multiple children, but only a single child was provided.
    src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx(168,12): error TS2322: Type 'RefObject<HTMLParagraphElement | null>' is not assignable to type
    'never'.
    src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx(168,22): error TS2322: Type 'CSSProperties' is not assignable to type 'never'.
    src/ts-tailwind/TextAnimations/SplitText/SplitText.tsx(168,36): error TS2322: Type 'string' is not assignable to type 'never'.

Expected result: the command exits successfully without TypeScript errors.

Validations

  • I have checked other issues to see if my issue was already reported or addressed

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions