Change type name to differentiate with the class

This commit is contained in:
Vibert Thio 2021-02-25 23:02:05 -05:00
parent 38ca13539a
commit c135ebb57d

View file

@ -18,7 +18,7 @@ type ClassesWithoutSingletons = Omit<typeof Classes, "Transport" | "Destination"
* The exported Tone object. Contains all of the classes that default * The exported Tone object. Contains all of the classes that default
* to the same context and contains a singleton Transport and Destination node. * to the same context and contains a singleton Transport and Destination node.
*/ */
type Tone = { type ToneObject = {
Transport: Transport; Transport: Transport;
Destination: Destination; Destination: Destination;
Listener: Listener; Listener: Listener;
@ -39,7 +39,7 @@ function bindTypeClass(context: Context, type) {
* Return an object with all of the classes bound to the passed in context * Return an object with all of the classes bound to the passed in context
* @param context The context to bind all of the nodes to * @param context The context to bind all of the nodes to
*/ */
export function fromContext(context: Context): Tone { export function fromContext(context: Context): ToneObject {
const classesWithContext: Partial<ClassesWithoutSingletons> = {}; const classesWithContext: Partial<ClassesWithoutSingletons> = {};
Object.keys(omitFromObject(Classes, ["Transport", "Destination", "Draw"])).map(key => { Object.keys(omitFromObject(Classes, ["Transport", "Destination", "Draw"])).map(key => {
@ -56,7 +56,7 @@ export function fromContext(context: Context): Tone {
} }
}); });
const toneFromContext: Tone = { const toneFromContext: ToneObject = {
...(classesWithContext as ClassesWithoutSingletons), ...(classesWithContext as ClassesWithoutSingletons),
now: context.now.bind(context), now: context.now.bind(context),
immediate: context.immediate.bind(context), immediate: context.immediate.bind(context),