The web audio API has its own types, one of them is BiquadFilterType
type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass"
I'm using a to let the user select which of the types he or she is going to use. So I made a function which receives a string (from the selector) and sets the biquadfilter.type to the received value so I had to give it a signature like
setValue(value: BiquadFilterType) ...
But when I try to call my function where the selector is ts complains that I'm giving the function a string whilst it was expecting a BiquadFilterType. Is there any way of checking (inside my function) the type (I've tried typeof and instanceof but none seem to make sense for TS) of the received argument so that TS knows that I'm using it correctly?