Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] JSII Compilation error for Class Decorator #33213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions packages/aws-cdk-lib/core/lib/prop-injectors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { log } from 'console';
import { inspect } from 'util';

type Constructor = { new (...args: any[]): {} };

/**
* This decorator applies property injection before calling the Construct's constructor.
* @param constructor constructor of the Construct
* @returns
*/
export function propertyInjectionDecorator<T extends Constructor>(constructor: T) {
log('In propertyInjectionDecorator');
return class extends constructor {
constructor(...args: any[]) {
const scope = args[0];
const id = args[1];
let props = args[2];

log(`Ctor scope: ${scope}, id: ${id}, old props: ${inspect(props)}`);

super(scope, id, props);
}

toString() {
return inspect(this);
}
};
}
Loading