AgoraIO-Extensions / AgoraIO-Extensions/agora-rtc-react

TypeScript: `setParameter` missing on `agora-rtc-react` default export

未關閉
#237 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
41
分支
14
PR 合併指標
30 天內沒有已合併 PR

描述

## Problem

The `agora-rtc-react` default export appears to be the underlying RTC SDK object at runtime, but the published TypeScript types do not include the static `setParameter` method. As a result, valid runtime calls fail type checking unless consumers import from `agora-rtc-sdk-ng` directly or use casts.

## Expected behavior

Consumers should be able to configure RTC SDK parameters using only the React SDK import:

```ts
import AgoraRTC from 'agora-rtc-react';

AgoraRTC.setParameter('ENABLE_AUDIO_PTS', true);
```

`setParameter` should be present on the default export type (or the default export type should be aligned with `agora-rtc-sdk-ng`’s public static API).

## Actual behavior

TypeScript reports that `setParameter` does not exist on the default export type (`IAgoraRTC` or equivalent), even though the runtime object supports the call.

Workarounds:

- Import `setParameter` from `agora-rtc-sdk-ng` / `agora-rtc-sdk-ng/esm`.
- Use a local type assertion to call `setParameter` on the React SDK default export.

## Use case

Conversational AI / transcript timing flows that require enabling `ENABLE_AUDIO_PTS` before publishing audio, without pulling in a second RTC package at the type or import level.

## Suggested resolution

- Add `setParameter(key: string, value: unknown): void` (or match the exact signature from `agora-rtc-sdk-ng`) to the default export typings, **or**
- Re-export / intersect the React SDK default export type with the RTC SDK static type so typings stay in sync as the base SDK evolves.

## Acceptance criteria

- `AgoraRTC.setParameter(...)` type-checks when `AgoraRTC` is imported from `agora-rtc-react`.
- No regression for existing hooks and named exports.
- Optional: a small type-only test or snippet in the repo that locks this in.

## Environment (example)

- Package: `agora-rtc-react` (version observed in app lockfile)
- TypeScript: strict / `noEmit` check in a Next.js app

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。