question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript error with React plugin on v7.3.0

See original GitHub issue

Hello,

I would like to report the new following TypeScript error following update to @bugsnag/js@7.3.0 and @bugsnag/plugin-react@7.3.0:

import React from 'react';
import Bugsnag from '@bugsnag/js';
import BugsnagPluginReact from '@bugsnag/plugin-react';

export const bugsnagClient = Bugsnag.createClient({
  // ... rest of config omitted for simplicity
  plugins: [new BugsnagPluginReact(React)],
  // 		^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Property 'load' is missing in type 'BugsnagPluginReact' but required in type 'Plugin'.ts(2741)
});

Seems to be a regression in the types definition introduced in the internal refactors made for the 7.3.0 release.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
imjoehainescommented, Jan 18, 2021

Hey @kamthamc, I’ve been investigating this and it’s a slightly different problem to the original issue. When using Yarn berry and Plug’n’Play, @bugsnag/react-native isn’t getting a copy of @bugsnag/core which it needs to resolve the types

We moved away from explicit dependencies on @bugsnag/core in our plugins because it causes a different Typescript issue when core is updated separately to a plugin (see https://github.com/bugsnag/bugsnag-js/issues/997)

I’m still investigating what we can do to make bugsnag-js work out of the box with Yarn berry, but one of these workarounds should fix the error in the meantime:

  • add pnpMode: loose to .yarnrc.yml
  • or add an explicit dependency on @bugsnag/core (i.e. run yarn add @bugsnag/core)
1reaction
kamthamccommented, Dec 11, 2020

@mattdyoung I have created a repo https://github.com/kamthamc/demo-bugsnag-js

Note: I am using yarn berry

If you want to use with vscode please run yarn dlx @yarnpkg/pnpify --sdk vscode

you can simply run yarn start to see the error.

Property 'load' is missing in type 'BugsnagPluginReact' but required in type 'Plugin'.  TS2741

    10 | export const bugsnagClient = Bugsnag.createClient({
    11 |   // ... rest of config omitted for simplicity
  > 12 |   plugins: [new BugsnagPluginReact(React)],
       |             ^
    13 | });
    14 |
    15 | ReactDOM.render(
Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Errors when using TypeScript + React - Stack Overflow
The errors are happening because the code is being transpiled with babel, then that transpiled code is being fed into AT loader.
Read more >
eslint-config-react-app - npm
ESLint configuration used by Create React App. Latest version: 7.0.1, last published: 8 months ago. Start using eslint-config-react-app in ...
Read more >
Introducing the New JSX Transform – React Blog
Manual Babel Setup​​ Support for the new JSX transform is available in Babel v7. 9.0 and above. First, you'll need to update to...
Read more >
Documentation - TypeScript 3.0
TypeScript 3.0 Release Notes. ... let v7: {} | null | undefined = x; // Error. } ... TypeScript 2.9 and earlier didn't...
Read more >
Changelog - Cypress Documentation
Fixed an issue with Angular Component Testing where a custom sourceRoot configuration would not be respected. Fixes #24827. Fixed Typescript typings for cy....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found