in src/declarative-stack.ts [335:357]
function deconstructStaticMethod(stack: cdk.Stack, typeRef: reflect.ClassType, value: any) {
const methods = typeRef.allMethods.filter(m => m.static);
const members = methods.map(x => x.name);
if (typeof(value) === 'object') {
const entries: Array<[ string, any ]> = Object.entries(value);
if (entries.length !== 1) {
throw new Error(`Value for enum-like class ${typeRef.fqn} must be an object with a single key (one of: ${members.join(',')})`);
}
const [methodName, args] = entries[0];
const method = methods.find(m => m.name === methodName);
if (!method) {
throw new Error(`Invalid member "${methodName}" for enum-like class ${typeRef.fqn}. Options: ${members.join(',')}`);
}
if (typeof(args) !== 'object') {
throw new Error(`Expecting enum-like member ${methodName} to be an object for enum-like class ${typeRef.fqn}`);
}
return invokeMethod(stack, method, args);
}
}