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

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

Abierto
#237 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
41
Forks
14
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.