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.

`Sentry.captureException` TypeScript types do not allow for basic usage

See original GitHub issue

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/types

SDK Version

latest

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

https://docs.sentry.io/platforms/javascript/enriching-events/context/

These docs demonstrate this usage:

Sentry.captureException(new Error("something went wrong"), {
  tags: {
    section: "articles",
  },
});

Expected Result

TypeScript should be okay with this example code

Actual Result

Argument of type '{ tags: { section: string; } }' is not assignable to parameter of type 'EventHint'.
  Object literal may only specify known properties, and 'tags' does not exist in type 'EventHint'.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frewsxcvcommented, Jul 12, 2022

So is there no way to do something like this?

import * as Sentry from "@sentry/browser";

declare global {
    interface Window {
        Sentry: Sentry;
    }
}

I’m looking for an interface that represents everything exported by the ~@sentry/browser~ Sentry JS library.

0reactions
AbhiPrasadcommented, Jul 12, 2022

Does typeof help here - or is there something else you’re doing here? Always happy to debug these things 😃

import * as Sentry from "@sentry/browser";

type EverySentryExport = typeof Sentry;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Usage - Sentry Documentation
The simplest way, is to try and explicitly capture and report potentially problematic code with a try...catch block and Raven.captureException . JavaScript.
Read more >
How to Add Sentry to Your Node.js Project with TypeScript
Sentry.io is an external monitoring and logging service which can help you identify and triage errors in your code.
Read more >
@sentry/types | Yarn - Package Manager
Going forward, the @sentry/replay package doesn't have to be installed explicitly to use Replay. Furthermore, this release increases the maximim replay session ...
Read more >
JavaScript - Docs - Sentry Documentation
Integrating the SDK. All our JavaScript-related SDKs provide the same API. Still, there are some differences between them, such as installation, ...
Read more >
How to capture TypeScript Firebase functions errors in Sentry
An easy way to ensure that any error that occurs in a function is automatically sent to Sentry.
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