diff --git a/packages/web-worker/types/notifier.test.ts b/packages/web-worker/types/notifier.test.ts new file mode 100644 index 0000000000..d86f3227f8 --- /dev/null +++ b/packages/web-worker/types/notifier.test.ts @@ -0,0 +1,24 @@ +import type { WorkerConfig } from './notifier'; + +describe('WorkerConfig type', () => { + it('should allow apiKey and custom fields', () => { + // This should type-check without error + const config: WorkerConfig = { + apiKey: '123', + collectUserIp: true, + generateAnonymousId: false + }; + expect(config.apiKey).toBe('123'); + expect(config.collectUserIp).toBe(true); + expect(config.generateAnonymousId).toBe(false); + }); + + it('should error if apiKey is missing', () => { + // @ts-expect-error: apiKey is required + const config: WorkerConfig = { + collectUserIp: true, + generateAnonymousId: false + }; + expect(config).toBeDefined(); + }); +}); diff --git a/packages/web-worker/types/notifier.ts b/packages/web-worker/types/notifier.ts index d0d61870ae..484e788631 100644 --- a/packages/web-worker/types/notifier.ts +++ b/packages/web-worker/types/notifier.ts @@ -14,4 +14,4 @@ declare const Bugsnag: WorkerBugsnagStatic export default Bugsnag export * from '@bugsnag/core' -export { WorkerConfig } +export type { WorkerConfig }