Skip to content

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

Merged
Lms24 merged 2 commits into
developfrom
lms/remix-fix-types
May 3, 2023
Merged

fix(remix): Export Integrations type declaration as union type#8016
Lms24 merged 2 commits into
developfrom
lms/remix-fix-types

Conversation

@Lms24

@Lms24Lms24 commented May 2, 2023

Copy link
Copy Markdown
Member

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';importtype{Integration,StackParser}from'@sentry/types';import*asclientSdkfrom'./index.client';importtype{RemixOptions}from'./utils/remixOptions';/** Initializes Sentry Remix SDK */exportdeclarefunctioninit(options: RemixOptions): void;exportdeclareconstIntegrations: {Apollo: typeofimport("@sentry-internal/tracing").Apollo;Express: typeofimport("@sentry-internal/tracing").Express;GraphQL: typeofimport("@sentry-internal/tracing").GraphQL;Mongo: typeofimport("@sentry-internal/tracing").Mongo;Mysql: typeofimport("@sentry-internal/tracing").Mysql;Postgres: typeofimport("@sentry-internal/tracing").Postgres;Prisma: typeofimport("@sentry-internal/tracing").Prisma;Console: typeofimport("@sentry/node/build/types/integrations").Console;Http: typeofimport("@sentry/node/build/types/integrations").Http;OnUncaughtException: typeofimport("@sentry/node/build/types/integrations").OnUncaughtException;OnUnhandledRejection: typeofimport("@sentry/node/build/types/integrations").OnUnhandledRejection;LinkedErrors: typeofimport("@sentry/node/build/types/integrations").LinkedErrors;Modules: typeofimport("@sentry/node/build/types/integrations").Modules;ContextLines: typeofimport("@sentry/node/build/types/integrations").ContextLines;Context: typeofimport("@sentry/node/build/types/integrations").Context;RequestData: typeofimport("@sentry/node/build/types/integrations").RequestData;LocalVariables: typeofimport("@sentry/node/build/types/integrations").LocalVariables;Undici: typeofimport("@sentry/node/build/types/integrations").Undici;FunctionToString: typeofclientSdk.FunctionToString;InboundFilters: typeofclientSdk.InboundFilters;GlobalHandlers: typeofclientSdk.GlobalHandlers;TryCatch: typeofclientSdk.TryCatch;Breadcrumbs: typeofclientSdk.Breadcrumbs;HttpContext: typeofclientSdk.HttpContext;Dedupe: typeofclientSdk.Dedupe;};exportdeclareconstdefaultIntegrations: Integration[];exportdeclareconstdefaultStackParser: StackParser;exportdeclareconstclose: typeofclientSdk.close;exportdeclareconstflush: typeofclientSdk.flush;exportdeclareconstlastEventId: typeofclientSdk.lastEventId;//# sourceMappingURL=index.types.d.ts.map

and here's the fixed output:

export*from'./index.client';export*from'./index.server';importtype{Integration,StackParser}from'@sentry/types';import*asclientSdkfrom'./index.client';import*asserverSdkfrom'./index.server';importtype{RemixOptions}from'./utils/remixOptions';/** Initializes Sentry Remix SDK */exportdeclarefunctioninit(options: RemixOptions): void;exportdeclareconstIntegrations: typeofclientSdk.Integrations&typeofserverSdk.Integrations;exportdeclareconstdefaultIntegrations: Integration[];exportdeclareconstdefaultStackParser: StackParser;exportdeclareconstclose: typeofclientSdk.close;exportdeclareconstflush: typeofclientSdk.flush;exportdeclareconstlastEventId: typeofclientSdk.lastEventId;//# sourceMappingURL=index.types.d.ts.map

closes#8001

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

github-actionsBot commented May 2, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
@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 developMay 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 freeto 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

@Lms24@mydea@AbhiPrasad