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

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

Đang mở
#237 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
41
Fork
14
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.