standardized-audio-context-mock icon indicating copy to clipboard operation
standardized-audio-context-mock copied to clipboard

overloading global AudioContext produces a typescript error

Open glend1 opened this issue 3 years ago • 13 comments

When you use;

import { AudioContext } from 'standardized-audio-context-mock';
global.AudioContext = AudioContext;

typescript gives you an error of;

Type 'typeof AudioContextMock' is not assignable to type '{ new (contextOptions?: AudioContextOptions | undefined): AudioContext; prototype: AudioContext; }'.
  Types of property 'prototype' are incompatible.
    Type 'AudioContextMock' is missing the following properties from type 'AudioContext': getOutputTimestamp, createScriptProcessor

glend1 avatar Dec 03 '21 13:12 glend1