Skip to content

Commit 4e32ec0

Browse files
committed
Bare minimum type stubs
1 parent cf731f4 commit 4e32ec0

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
/* Users may not have these packages installed, this prevents errors when using `tsc` without them. */
3+
/* eslint-disable @typescript-eslint/no-empty-object-type */
4+
declare module '@opentelemetry/api' {
5+
type _ = any;
6+
7+
export interface Span extends _ {}
8+
export interface Tracer extends _ {}
9+
export interface SpanContext extends _ {}
10+
export enum SpanStatusCode {
11+
ERROR = 2
12+
}
13+
export interface PropagationAPI extends _ {}
14+
export interface ContextAPI extends _ {}
15+
export const trace: Tracer;
16+
export const propagation: PropagationAPI;
17+
export const context: ContextAPI;
18+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
LayoutParams as AppLayoutParams,
2626
ResolvedPathname
2727
} from '$app/types';
28-
// @ts-ignore - some users might not have this installed.
28+
2929
import { Span } from '@opentelemetry/api';
3030

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

packages/kit/src/runtime/telemetry/record_span.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export async function record_span({ name, attributes, fn }) {
1111

1212
const { SpanStatusCode, tracer } = await otel;
1313

14-
return tracer.startActiveSpan(name, { attributes }, async (span) => {
14+
return tracer.startActiveSpan(name, { attributes }, async (/** @type {import('@opentelemetry/api').Span} */ span) => {
1515
try {
1616
return await fn(span);
1717
} catch (error) {

0 commit comments

Comments
 (0)