From de354dbbdd24bb9f93edef6d098fe8484c7bc3ff Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Thu, 20 Apr 2023 02:02:52 -0700 Subject: [PATCH] fix: VisibilityState type for typescript >4.6 (#3741) Co-authored-by: Nev <54870357+MSNev@users.noreply.github.com> --- .../test/browser/export/BatchLogRecordProcessor.test.ts | 8 +++++++- .../test/browser/export/BatchSpanProcessor.test.ts | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/experimental/packages/sdk-logs/test/browser/export/BatchLogRecordProcessor.test.ts b/experimental/packages/sdk-logs/test/browser/export/BatchLogRecordProcessor.test.ts index e176f3e7dd..7bef5aeb25 100644 --- a/experimental/packages/sdk-logs/test/browser/export/BatchLogRecordProcessor.test.ts +++ b/experimental/packages/sdk-logs/test/browser/export/BatchLogRecordProcessor.test.ts @@ -24,8 +24,14 @@ import { InMemoryLogRecordExporter } from './../../../src/export/InMemoryLogReco const describeDocument = typeof document === 'object' ? describe : describe.skip; +/** + * VisibilityState has been removed from TypeScript 4.6.0+ + */ +type WebVisibilityState = 'visible' | 'hidden'; + describeDocument('BatchLogRecordProcessor - web main context', () => { - let visibilityState: VisibilityState = 'visible'; + // TODO: change to DocumentVisibilityState when TypeScript is upgraded to 4.6+ + let visibilityState: WebVisibilityState = 'visible'; let exporter: LogRecordExporter; let processor: BatchLogRecordProcessor; let forceFlushSpy: sinon.SinonStub; diff --git a/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts b/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts index f510d518ff..901dd74ebf 100644 --- a/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts +++ b/packages/opentelemetry-sdk-trace-base/test/browser/export/BatchSpanProcessor.test.ts @@ -30,6 +30,7 @@ const describeDocument = typeof document === 'object' ? describe : describe.skip; describeDocument('BatchSpanProcessor - web main context', () => { + // TODO: change to DocumentVisibilityState when TypeScript is upgraded to 4.6+ let visibilityState: WebVisibilityState = 'visible'; let exporter: SpanExporter; let processor: BatchSpanProcessor;