opentok-network-test-js icon indicating copy to clipboard operation
opentok-network-test-js copied to clipboard

Argument of type 'typeof OT' is not assignable to parameter of type 'Client'.

Open pardeep-k opened this issue 4 years ago • 4 comments

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 });

pardeep-k avatar Sep 22 '20 09:09 pardeep-k

🤔 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

cnadeau avatar Oct 09 '20 11:10 cnadeau

Found how to import it from TypeScript:

import '@opentok/client';
declare var OT: any;

cnadeau avatar Oct 09 '20 18:10 cnadeau

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.

dmitryshur avatar Feb 07 '21 04:02 dmitryshur

Please see this stackblitz for a minimal reproduction.

jgbpercy avatar Oct 05 '22 11:10 jgbpercy