opentok-network-test-js
opentok-network-test-js copied to clipboard
Argument of type 'typeof OT' is not assignable to parameter of type 'Client'.
import { OT } from "opentok-network-test-js/dist/NetworkTest/types/opentok"; not working import * as OT from "@opentok/client"; not working
new NetworkTest(OT, { // OT giving error Argument of type 'typeof OT' is not assignable to parameter of type 'Client'. how to resolve this im using this in angular apiKey: apiKey, sessionId: sessionId, // Add a test session ID for that project token: token, // Add a token for that session here });
🤔 according to this test, it should be import * as OT from '@opentok/client
but, from the sample (in JS, not in TypeScript), commenting the opentok.min.js script and importing OT here as import OT from '@opentok/client
works
it's definitely a typescript error
Found how to import it from TypeScript:
import '@opentok/client';
declare var OT: any;
I'm sorry, but declaring OT as any is not a solution. there is a type error here and it's in the ScreenSharingCapabilityResponse
type. this is what ScreenSharingCapabilityResponse
looks like in @opentok/client
:
export type ScreenSharingCapabilityResponse = {
extensionInstalled?: boolean;
supported: boolean;
supportedSources: {
application?: boolean;
screen?: boolean;
window?: boolean;
};
extensionRequired?: string;
extensionRegistered?: boolean;
};
this is what it looks like in opentok-network-test-js
:
export interface ScreenSharingCapabilityResponse {
extensionInstalled: boolean;
supported: boolean;
supportedSources: {
application: boolean;
screen: boolean;
window: boolean;
};
extensionRegistered?: string;
the definition for extensionInstalled
conflicts.
Please see this stackblitz for a minimal reproduction.