How can I instanciate javascript class in type script?
For exemple:
class LiveAudioFreq {
context;
constructor(){
context = new window.AudioContext();
}
}
Give me the error:
error TS2094: The property 'AudioContext' does not exist on value of type 'Window'.
And refuse to compile, how can I use javascript methods in my ts file?
In the constructor, use:
Rather than just
Also, where have you defined AudioContext? It is likely that this won't be in the standard library until it is implemented everywhere, so you may need to create an ambient declaration.