Skip to content

Commit 13d9ed3

Browse files
dummdidummteemingc
andauthored
fix: Prevent type errors when optional @opentelemetry/api dependency isn't installed (#14949)
* fix: Prevent type errors when optional `@opentelemetry/api` dependency isn't installed Fixes #14774 Better alternative to #14848 * Apply suggestion from @teemingc --------- Co-authored-by: Tee Ming <[email protected]>
1 parent 66de71b commit 13d9ed3

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.changeset/flat-steaks-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
fix: prevent type errors when optional `@opentelemetry/api` dependency isn't installed

packages/kit/src/exports/public.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ import {
2525
LayoutParams as AppLayoutParams,
2626
ResolvedPathname
2727
} from '$app/types';
28-
import { Span } from '@opentelemetry/api';
2928

3029
export { PrerenderOption } from '../types/private.js';
3130

31+
// @ts-ignore this is an optional peer dependency so could be missing. Written like this so dts-buddy preserves the ts-ignore
32+
type Span = import('@opentelemetry/api').Span;
33+
3234
/**
3335
* [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.
3436
*/

packages/kit/types/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ declare module '@sveltejs/kit' {
55
import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte';
66
import type { StandardSchemaV1 } from '@standard-schema/spec';
77
import type { RouteId as AppRouteId, LayoutParams as AppLayoutParams, ResolvedPathname } from '$app/types';
8-
import type { Span } from '@opentelemetry/api';
8+
// @ts-ignore this is an optional peer dependency so could be missing. Written like this so dts-buddy preserves the ts-ignore
9+
type Span = import('@opentelemetry/api').Span;
10+
911
/**
1012
* [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.
1113
*/

0 commit comments

Comments
 (0)