rollbar / rollbar/rollbar-react

TypeScript types don't match implementation

Open
#69 4 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46
Forks
9
Avg merge
2d 56m
Merged PRs (30d)
4

Description

Currently, the TypeScript type definitions do not match the documentation nor the implementation. Here are the problems I've encountered so far in one afternoon of integrating the library:

  • <ErrorBoundary> has a fallbackUI prop, which is a ReactNode (the result of rendering a component) in types, but is assumed to be a function (a functional component) in the implementation. The correct type would most likely be React.ComponentType<{}> or React.FC<{}>.
  • historyContext has multiple issues:
    • The documentation (and implementation) claims to support both History v4 and History v5, but the types are only compatible with V4.
    • filter and formatter functions receive location as a string, but it is in fact a Location object, not a string.
    • filter and formatter are documented as optional, but they are required arguments in types.
    • Furthermore, the types are not correct even for V4:
      • The function returns a callback which receives an object consisting of action and filter, but this seems like a copy-paste mistake and the correct signature is probably (location: Location, action: string).
      • You need to define your own Location type, unless you want to take a dependency on history.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing index.d.ts with src/error-boundary.js and src/history-context.js, then check the linked documentation and implementation references for the supported signatures. Align fallbackUI and historyContext types with the documented and implemented behavior, including optional arguments and History v4/v5 compatibility. Done means the declarations no longer contradict those sources.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, typescript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.