Skip to content

fix(remix): Export Integrations type declaration as union type #8016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented May 2, 2023

This PR changes the isomorphic type declarations of Sentry.Integrations to a union type rather than an object. This stops tsc from resolving the types of the individual integration types which caused errors due to incorrect path resolvings of dependencies of @sentry/remix. With this change we now declare Sentry.Integrations in Remix identically to how we do it in NextJS and SvelteKit.

Details

Here's the incorrect TSC output from 7.45 to 7.50 (after #7575 was merged)

export * from './index.client';
export * from './index.server';
import type { Integration, StackParser } from '@sentry/types';
import * as clientSdk from './index.client';
import type { RemixOptions } from './utils/remixOptions';
/** Initializes Sentry Remix SDK */
export declare function init(options: RemixOptions): void;
export declare const Integrations: {
    Apollo: typeof import("@sentry-internal/tracing").Apollo;
    Express: typeof import("@sentry-internal/tracing").Express;
    GraphQL: typeof import("@sentry-internal/tracing").GraphQL;
    Mongo: typeof import("@sentry-internal/tracing").Mongo;
    Mysql: typeof import("@sentry-internal/tracing").Mysql;
    Postgres: typeof import("@sentry-internal/tracing").Postgres;
    Prisma: typeof import("@sentry-internal/tracing").Prisma;
    Console: typeof import("@sentry/node/build/types/integrations").Console;
    Http: typeof import("@sentry/node/build/types/integrations").Http;
    OnUncaughtException: typeof import("@sentry/node/build/types/integrations").OnUncaughtException;
    OnUnhandledRejection: typeof import("@sentry/node/build/types/integrations").OnUnhandledRejection;
    LinkedErrors: typeof import("@sentry/node/build/types/integrations").LinkedErrors;
    Modules: typeof import("@sentry/node/build/types/integrations").Modules;
    ContextLines: typeof import("@sentry/node/build/types/integrations").ContextLines;
    Context: typeof import("@sentry/node/build/types/integrations").Context;
    RequestData: typeof import("@sentry/node/build/types/integrations").RequestData;
    LocalVariables: typeof import("@sentry/node/build/types/integrations").LocalVariables;
    Undici: typeof import("@sentry/node/build/types/integrations").Undici;
    FunctionToString: typeof clientSdk.FunctionToString;
    InboundFilters: typeof clientSdk.InboundFilters;
    GlobalHandlers: typeof clientSdk.GlobalHandlers;
    TryCatch: typeof clientSdk.TryCatch;
    Breadcrumbs: typeof clientSdk.Breadcrumbs;
    HttpContext: typeof clientSdk.HttpContext;
    Dedupe: typeof clientSdk.Dedupe;
};
export declare const defaultIntegrations: Integration[];
export declare const defaultStackParser: StackParser;
export declare const close: typeof clientSdk.close;
export declare const flush: typeof clientSdk.flush;
export declare const lastEventId: typeof clientSdk.lastEventId;
//# sourceMappingURL=index.types.d.ts.map

and here's the fixed output:

export * from './index.client';
export * from './index.server';
import type { Integration, StackParser } from '@sentry/types';
import * as clientSdk from './index.client';
import * as serverSdk from './index.server';
import type { RemixOptions } from './utils/remixOptions';
/** Initializes Sentry Remix SDK */
export declare function init(options: RemixOptions): void;
export declare const Integrations: typeof clientSdk.Integrations & typeof serverSdk.Integrations;
export declare const defaultIntegrations: Integration[];
export declare const defaultStackParser: StackParser;
export declare const close: typeof clientSdk.close;
export declare const flush: typeof clientSdk.flush;
export declare const lastEventId: typeof clientSdk.lastEventId;
//# sourceMappingURL=index.types.d.ts.map

closes #8001

@Lms24 Lms24 requested a review from a team May 2, 2023 15:15
@Lms24 Lms24 self-assigned this May 2, 2023
@Lms24 Lms24 requested review from mydea and AbhiPrasad and removed request for a team May 2, 2023 15:15
@Lms24 Lms24 changed the title fix(remix): Export Integration type declaration as union type fix(remix): Export Integrations type declaration as union type May 2, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 21.02 KB (-0.01% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 65.66 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.56 KB (0%)
@sentry/browser - ES6 CDN Bundle (minified) 58.12 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 21.17 KB (0%)
@sentry/browser - Webpack (minified) 69.07 KB (0%)
@sentry/react - Webpack (gzipped + minified) 21.19 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 49.09 KB (+0.08% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.64 KB (+0.07% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.87 KB (+0.12% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 46.87 KB (0%)
@sentry/replay - Webpack (gzipped + minified) 40.67 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 65.75 KB (+0.06% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 58.64 KB (-0.01% 🔽)

@Lms24 Lms24 merged commit b9fb55f into develop May 3, 2023
@Lms24 Lms24 deleted the lms/remix-fix-types branch May 3, 2023 16:05
billyvg pushed a commit that referenced this pull request May 5, 2023
Change the isomorphic type declarations of `Sentry.Integrations` to a union type rather than an object. This stops `tsc` from resolving the types of the individual integration types which caused errors due to incorrect path resolvings of dependencies of `@sentry/remix`. With this change we now declare `Sentry.Integrations` in Remix identically to how we do it in NextJS and SvelteKit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@sentry/remix internal built-types have wrong paths
3 participants