bugsnag-js icon indicating copy to clipboard operation
bugsnag-js copied to clipboard

Typescript: Property 'use' does not exist on type 'UniversalBugsnagStatic'

Open danawoodman opened this issue 5 years ago • 1 comments

Describe the bug

Follow docs described here does not work with Typescript: https://github.com/bugsnag/bugsnag-js/tree/next/packages/plugin-react

Get the following error with the types:

Property 'use' does not exist on type 'UniversalBugsnagStatic'
Screen Shot 2020-08-28 at 11 36 16

Using:

    "@bugsnag/js": "7.3.3",
    "@bugsnag/plugin-react": "7.3.3",

Steps to reproduce

Create a Typescript file with the following:

import React from "react"
import Bugsnag from "@bugsnag/js"
import bugsnagReact from "@bugsnag/plugin-react"

Bugsnag.use(bugsnagReact, React)
Bugsnag.start(process.env.BUGSNAG_BROWSER_API_KEY)

export const ErrorBoundary = Bugsnag.getPlugin("react")

Environment

  • Bugsnag version: 7.3.3
  • Browser framework version (if any):
    • React: 16.9.44 (with Next.js)
  • Server framework version (if any):
    • Next.js
  • Browser version (e.g. chrome, safari): Chrome
  • Device (e.g. iphonex): MacbookPro

danawoodman avatar Aug 28 '20 18:08 danawoodman

Hi @danawoodman

Apologies, the README has drifted out of date with our latest documentation as there have been some breaking changes: https://github.com/bugsnag/bugsnag-js/blob/next/UPGRADING.md#6x-to-7x https://github.com/bugsnag/bugsnag-js/blob/next/UPGRADING.md#70-to-71

To integrate Bugsnag in a React app please follow our latest documentation here: https://docs.bugsnag.com/platforms/javascript/react/

I'll leave this issue open to address correcting the README to refer to the latest instructions.

mattdyoung avatar Sep 01 '20 14:09 mattdyoung