getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.97k stars 1.57k forks source link

[Ember] Type Problem Introduced in v6.10? #4172

Closed jherdman closed 2 years ago

jherdman commented 2 years ago

Package + Version

Version:

6.10.0+

Description

In upgrading an application using @sentry/ember v6.6.0 to v6.15 we ran into some peculiar type regressions. Here's a snippet of our code that worked before:

    assert(
      '[ember-metrics] You must configure Heap adapter. See documentation.',
      typeof config !== 'undefined'
    );

    const { appId, pageViewPrefix } = config;

Using v6.6.0 this code works, but suddenly, when v6.10 (or later), is introduced we see the type for assert fail.

I'm not entirely sure this is the problem, but this is a bit of a smoking gun:

https://github.com/getsentry/sentry-javascript/blob/a72ea443ffb45657a9e52b37c35f5c005e176463/packages/ember/addon/index.ts#L11-L13

Note that this typing differs from the DefinitelyTyped version:

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/4a4f37536cec0d38819acd9015600de7715ac6b3/types/ember__debug/index.d.ts#L10-L14

I believe that If you were to use the @types/ember__debug package instead of rolling your own type this problem should be resolved.

jherdman commented 2 years ago

4173 — though I cannot confirm yet that this resolves our issue. I'm still exploring the changes introduced by v6.10.

jherdman commented 2 years ago

Correction: I see this merely by moving to v6.9

k-fish commented 2 years ago

@jherdman great suggestion, will follow up in the PR.

AbhiPrasad commented 2 years ago

@jherdman just wanted to circle back to ask if you were still encountering these issues?

jherdman commented 2 years ago

Confirmed! Many thanks.