From a78fba072a0c239bacce2259962d9d693a4b0c61 Mon Sep 17 00:00:00 2001 From: Yotam Mann Date: Sun, 19 Jul 2020 12:04:03 -0700 Subject: [PATCH] make sure the defaults belong to the template --- Tone/component/channel/Recorder.ts | 4 ++-- Tone/core/util/Defaults.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tone/component/channel/Recorder.ts b/Tone/component/channel/Recorder.ts index 30ad469b..c97173a9 100644 --- a/Tone/component/channel/Recorder.ts +++ b/Tone/component/channel/Recorder.ts @@ -55,8 +55,8 @@ export class Recorder extends ToneAudioNode { constructor(options?: Partial); 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 diff --git a/Tone/core/util/Defaults.ts b/Tone/core/util/Defaults.ts index ea45fbfd..23f65e16 100644 --- a/Tone/core/util/Defaults.ts +++ b/Tone/core/util/Defaults.ts @@ -56,10 +56,10 @@ export function deepEquals(arrayA: number[] | string[], arrayB: number[] | strin export function optionsFromArguments( defaults: T, argsArray: IArguments, - keys: string[] = [], - objKey?: string, + keys: Array = [], + objKey?: keyof T, ): T { - const opts: any = {}; + const opts: Partial = {}; 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)) {