fix(companion): type-guard event wait name validation
This commit is contained in:
@@ -437,7 +437,7 @@ export class CompanionRuntimeClient {
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<TData> {
|
||||
if (eventName.trim().length === 0) {
|
||||
if (typeof eventName !== 'string' || eventName.trim().length === 0) {
|
||||
throw new Error('eventName must be a non-empty string');
|
||||
}
|
||||
const timeoutMs = options?.timeoutMs ?? this.requestTimeoutMs;
|
||||
@@ -505,7 +505,11 @@ export class CompanionRuntimeClient {
|
||||
if (eventNames.length === 0) {
|
||||
throw new Error('eventNames must contain at least one event name');
|
||||
}
|
||||
if (eventNames.some((eventName) => eventName.trim().length === 0)) {
|
||||
if (
|
||||
eventNames.some(
|
||||
(eventName) => typeof eventName !== 'string' || eventName.trim().length === 0,
|
||||
)
|
||||
) {
|
||||
throw new Error('eventNames must not contain empty values');
|
||||
}
|
||||
const eventNameSet = new Set(eventNames);
|
||||
|
||||
Reference in New Issue
Block a user