This PR allows PolySynth to support instruments built from scratch by extending Monophonic, by inferring the Options type used by the instrument. This is safe since we know this must extend MonophonicOptions.
// in VoiceOptions<T>
/* ... */ T extends Monophonic<infer U> ? U : /* ... */
I can't forsee any issues with this conflicting with previous types above this expression, since they will match before this statement is reached - might even be simpler to use this instead of those matches!
I cannot verify whether this is passing tests - since Tone.JS appears to run its test on Node 11, it's near impossible for me to build it without resorting to Rosetta emulation - so testing would be very much appreciated! ❤️
This PR allows PolySynth to support instruments built from scratch by extending Monophonic, by inferring the Options type used by the instrument. This is safe since we know this must extend
MonophonicOptions
.I can't forsee any issues with this conflicting with previous types above this expression, since they will match before this statement is reached - might even be simpler to use this instead of those matches!
I cannot verify whether this is passing tests - since Tone.JS appears to run its test on Node 11, it's near impossible for me to build it without resorting to Rosetta emulation - so testing would be very much appreciated! ❤️