From ab915baea5677ace72f523338bbb9c27255861cd Mon Sep 17 00:00:00 2001 From: aoife cassidy Date: Mon, 18 Nov 2024 11:39:49 +0200 Subject: [PATCH] chore(tsconfig): enable `noUncheckedIndexedAccess` (#336) --- .changeset/flat-turtles-leave.md | 5 +++++ packages/livekit-rtc/src/audio_frame.ts | 4 ++-- packages/livekit-rtc/src/video_frame.ts | 2 +- packages/livekit-rtc/tsconfig.json | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/flat-turtles-leave.md diff --git a/.changeset/flat-turtles-leave.md b/.changeset/flat-turtles-leave.md new file mode 100644 index 00000000..7b74b89e --- /dev/null +++ b/.changeset/flat-turtles-leave.md @@ -0,0 +1,5 @@ +--- +"@livekit/rtc-node": patch +--- + +chore(tsconfig): enable `noUncheckedIndexedAccess` diff --git a/packages/livekit-rtc/src/audio_frame.ts b/packages/livekit-rtc/src/audio_frame.ts index 1364014e..f63b23aa 100644 --- a/packages/livekit-rtc/src/audio_frame.ts +++ b/packages/livekit-rtc/src/audio_frame.ts @@ -72,8 +72,8 @@ export const combineAudioFrames = (buffer: AudioFrame | AudioFrame[]): AudioFram throw new Error('buffer is empty'); } - const sampleRate = buffer[0].sampleRate; - const channels = buffer[0].channels; + const sampleRate = buffer[0]!.sampleRate; + const channels = buffer[0]!.channels; let totalSamplesPerChannel = 0; for (const frame of buffer) { diff --git a/packages/livekit-rtc/src/video_frame.ts b/packages/livekit-rtc/src/video_frame.ts index 3cded75e..e92ede56 100644 --- a/packages/livekit-rtc/src/video_frame.ts +++ b/packages/livekit-rtc/src/video_frame.ts @@ -78,7 +78,7 @@ export class VideoFrame { const planeInfos = getPlaneInfos(this.dataPtr, this.type, this.width, this.height); if (planeNth >= planeInfos.length) return; - const planeInfo = planeInfos[planeNth]; + const planeInfo = planeInfos[planeNth]!; return FfiClient.instance.copyBuffer(planeInfo.dataPtr, planeInfo.size); } diff --git a/packages/livekit-rtc/tsconfig.json b/packages/livekit-rtc/tsconfig.json index e8483375..279ee5ec 100644 --- a/packages/livekit-rtc/tsconfig.json +++ b/packages/livekit-rtc/tsconfig.json @@ -10,7 +10,8 @@ "moduleResolution": "node", "sourceMap": true, "outDir": "dist", - "strict": true + "strict": true, + "noUncheckedIndexedAccess": true }, "include": ["src/**/*.ts"], "exclude": ["src/**/*.test.ts", "vite.config.ts"]