Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

Problem

TypeScript compilation fails after updating react-error-boundary to 6.1.0 and @types/react to 19.2.9. The FallbackProps.error type changed from Error to unknown, breaking the ErrorFallback component signature.

Changes

Updated ErrorFallback component (src/main.tsx):

  • Changed error parameter type from Error to unknown
  • Added type guard to safely extract error message

Updated dependencies:

  • react-error-boundary: 6.0.3 → 6.1.0
  • @types/react: 19.2.8 → 19.2.9

Implementation

// Before
function ErrorFallback({ error }: { error: Error }): React.ReactElement {
  return <pre>{error.message}</pre>;
}

// After
function ErrorFallback({ error }: { error: unknown }): React.ReactElement {
  const errorMessage = error instanceof Error ? error.message : String(error);
  return <pre>{errorMessage}</pre>;
}

The type guard maintains runtime safety while satisfying the stricter type constraints from the library update.

Original prompt

fix problem with PR

game-app@1.2.19 build
tsc -b && vite build

Error: src/main.tsx(26,20): error TS2322: Type '({ error }: { error: Error; }) => ReactElement<unknown, string | JSXElementConstructor>' is not assignable to type 'ComponentType'.
Type '({ error }: { error: Error; }) => ReactElement<unknown, string | JSXElementConstructor>' is not assignable to type 'FunctionComponent'.
Types of parameters '__0' and 'props' are incompatible.
Type 'FallbackProps' is not assignable to type '{ error: Error; }'.
Types of property 'error' are incompatible.
Type 'unknown' is not assignable to type 'Error'.
Error: Process completed with exit code 1.

#421

and update

Updates react-error-boundary from 6.0.3 to 6.1.0

Release notes
Commits

Updates @types/react from 19.2.8 to 19.2.9

Commits

Custom agent used: frontend-specialist
Expert in React and UI development with strict TypeScript, modern hooks, and component architecture


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 20, 2026 23:31
Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
…ary 6.1.0

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix type error in error boundary component Fix ErrorFallback type compatibility with react-error-boundary 6.1.0 Jan 20, 2026
Copilot AI requested a review from pethers January 20, 2026 23:35
@github-actions github-actions bot added dependencies Dependency updates infrastructure CI/CD and build infrastructure component-main Main component changes high-coverage High test coverage areas labels Jan 21, 2026
@pethers
Copy link
Member

pethers commented Jan 21, 2026

@copilot always use strict typing for code and test

Run npm run build

game-app@1.2.19 build
tsc -b && vite build

Error: src/main.tsx(26,20): error TS2322: Type '({ error }: { error: Error; }) => ReactElement<unknown, string | JSXElementConstructor>' is not assignable to type 'ComponentType'.
Type '({ error }: { error: Error; }) => ReactElement<unknown, string | JSXElementConstructor>' is not assignable to type 'FunctionComponent'.
Types of parameters '__0' and 'props' are incompatible.
Type 'FallbackProps' is not assignable to type '{ error: Error; }'.
Types of property 'error' are incompatible.
Type 'unknown' is not assignable to type 'Error'.
Error: Process completed with exit code 1.

@pethers pethers marked this pull request as ready for review January 21, 2026 00:31
@pethers pethers merged commit 6dc09bc into main Jan 21, 2026
14 of 15 checks passed
@pethers pethers deleted the copilot/fix-pr-type-errors branch January 21, 2026 00:31
Copilot stopped work on behalf of pethers due to an error January 21, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component-main Main component changes dependencies Dependency updates high-coverage High test coverage areas infrastructure CI/CD and build infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants