make sure the defaults belong to the template

This commit is contained in:
Yotam Mann 2020-07-19 12:04:03 -07:00
parent caff06106b
commit a78fba072a
2 changed files with 5 additions and 5 deletions

View file

@ -55,8 +55,8 @@ export class Recorder extends ToneAudioNode<RecorderOptions> {
constructor(options?: Partial<RecorderOptions>);
constructor() {
super(optionsFromArguments(Recorder.getDefaults(), arguments, ["gain", "units"]));
const options = optionsFromArguments(Recorder.getDefaults(), arguments, ["gain", "units"]);
super(optionsFromArguments(Recorder.getDefaults(), arguments));
const options = optionsFromArguments(Recorder.getDefaults(), arguments);
this.input = new Gain({
context: this.context

View file

@ -56,10 +56,10 @@ export function deepEquals(arrayA: number[] | string[], arrayB: number[] | strin
export function optionsFromArguments<T extends object>(
defaults: T,
argsArray: IArguments,
keys: string[] = [],
objKey?: string,
keys: Array<keyof T> = [],
objKey?: keyof T,
): T {
const opts: any = {};
const opts: Partial<T> = {};
const args = Array.from(argsArray);
// if the first argument is an object and has an object key
if (isObject(args[0]) && objKey && !Reflect.has(args[0], objKey)) {