Skip to content

@sentry/remix: Incompatible type in wrapRemixHandleError #10212

Closed
@haines

Description

@haines

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/remix

SDK Version

7.93.0

Framework Version

2.5.0

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

https://github.com/haines/sentry-remix-type-error

Instead of doing

export const handleError = wrapRemixHandleError;

attempt to call wrapRemixHandleError within an existing handleError method

export function handleError(
  error: unknown,
  args: ActionFunctionArgs | LoaderFunctionArgs,
): void {
  wrapRemixHandleError(error, args);
  // ...
}

Expected Result

Code type-checks successfully.

Actual Result

TypeScript reports an error

error TS2345: Argument of type 'ActionFunctionArgs | LoaderFunctionArgs' is not assignable to parameter of type 'DataFunctionArgs'.
  Type 'ActionFunctionArgs' is not assignable to type 'DataFunctionArgs'.
    Types of property 'request' are incompatible.
      Type 'Request' is not assignable to type 'RemixRequest'.
        Type 'Request' is not assignable to type 'Record<string | symbol, RemixRequestState>'.
          Index signature for type 'string' is missing in type 'Request'.

(the error is the same if you use the deprecated DataFunctionArgs type from Remix, so it's not just because of the change to use ActionFunctionArgs | LoaderFunctionArgs).

Metadata

Metadata

Assignees

Labels

Package: remixIssues related to the Sentry Remix SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions