Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions js/packages/core/__tests__/metro-event-type.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Type-level test for metro event type.
*
* This test verifies that 'metro' is recognized as a valid event name
* in EventTypes, so that core.on('metro', callback) compiles without
* TypeScript errors.
*
* See: https://github.com/elemaudio/elementary/issues/73
*/
import EventEmitter from '../src/Events';

// This should compile without errors: metro is a valid event type
const emitter = new EventEmitter();

emitter.on('metro', (data) => {
// The metro event payload should have an optional source field
const source: string | undefined = data.source;
});
1 change: 1 addition & 0 deletions js/packages/core/src/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type EventTypes = {
fft: (data: { source?: string, data: { real: Float32Array, imag: Float32Array } }) => void;
load: () => void;
meter: (data: { source?: string, min: number; max: number, }) => void;
metro: (data: { source?: string }) => void;
scope: (data: { source?: string, data: Float32Array[] }) => void;
snapshot: (data: { source?: string, data: number }) => void;
};
Expand Down