IEvangelist / IEvangelist.VideoChat

Imagine two Twilio SDKs, ASP.NET Core/C#, Angular/TypeScript, SignalR, etc... Yeah, amazing!
http://bit.ly/video-chat-tutorial
MIT License
67 stars 59 forks source link

Element implicitly has an 'any' type because index expression is not of type 'number' #50

Closed sangheraajit closed 2 years ago

sangheraajit commented 2 years ago

We are getting the following error

Element implicitly has an 'any' type because index expression is not of type 'number'

method name

private async tryGetDevices() {
        const mediaDevices = await navigator.mediaDevices.enumerateDevices();
        console.log("mediaDevices",mediaDevices)
       //return mediaDevices;
     const devices = ['audioinput', 'audiooutput', 'videoinput'].reduce((options , kind) => {
            return options[kind] = mediaDevices.filter(device => device.kind === kind);
        }, [] as Devices);
        return devices;         
    }
image
IEvangelist commented 2 years ago

Hi @sangheraajit - I think you might be able to solve this by adding this to the tsconfig.json.

{
    "suppressImplicitAnyIndexErrors": true
}
sangheraajit commented 2 years ago

Hi, Thanks that's works. But this seems workaround we should fix the issue.

IEvangelist commented 2 years ago

@sangheraajit I always welcome pull requests, please submit one with your fix and I'll happily review it, and likely merge it in. Reference this issue when you do. If you're not able to submit a PR, we can close this issue as the code works.