evanderkoogh / otel-cf-workers

An OpenTelemetry compatible library for instrumenting and exporting traces for Cloudflare Workers
BSD 3-Clause "New" or "Revised" License
208 stars 39 forks source link

Make ResolveConfigFn type generic #108

Closed DaniFoldi closed 3 months ago

DaniFoldi commented 3 months ago

Fixes # [insert GH issue number(s)].

What this PR solves / how to test:

When setting up a new worker today, I copied the otel config resolver from another project. Unfortunately, the secret containing the api key had a different name there than I intended having in the new worker.

ResolveConfigFn previously had env: any, which means ts didn't catch this error. It now accepts an optional type parameter which allows users to typecheck their config resolver function better.