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

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

Aperta
#237 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
41
Fork
14
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.