diff --git a/.changeset/flat-steaks-yawn.md b/.changeset/flat-steaks-yawn.md new file mode 100644 index 000000000000..0a2e32361c17 --- /dev/null +++ b/.changeset/flat-steaks-yawn.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/kit': patch +--- + +fix: prevent type errors when optional `@opentelemetry/api` dependency isn't installed diff --git a/packages/kit/src/exports/public.d.ts b/packages/kit/src/exports/public.d.ts index 39174438f805..21ed3e6cda00 100644 --- a/packages/kit/src/exports/public.d.ts +++ b/packages/kit/src/exports/public.d.ts @@ -25,10 +25,12 @@ import { LayoutParams as AppLayoutParams, ResolvedPathname } from '$app/types'; -import { Span } from '@opentelemetry/api'; export { PrerenderOption } from '../types/private.js'; +// @ts-ignore this is an optional peer dependency so could be missing. Written like this so dts-buddy preserves the ts-ignore +type Span = import('@opentelemetry/api').Span; + /** * [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing. */ diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index 548bc7a78d83..35b387405f53 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -5,7 +5,9 @@ declare module '@sveltejs/kit' { import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte'; import type { StandardSchemaV1 } from '@standard-schema/spec'; import type { RouteId as AppRouteId, LayoutParams as AppLayoutParams, ResolvedPathname } from '$app/types'; - import type { Span } from '@opentelemetry/api'; + // @ts-ignore this is an optional peer dependency so could be missing. Written like this so dts-buddy preserves the ts-ignore + type Span = import('@opentelemetry/api').Span; + /** * [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing. */