Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: improve type annotation for CustomResource properties #29541

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 10 additions & 1 deletion packages/aws-cdk-lib/core/lib/custom-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { RemovalPolicy } from './removal-policy';
import { Resource } from './resource';
import { Token } from './token';

// Note that CloudFormation only supports the subset of JSON where the leaf nodes are strings.
// See https://github.com/aws/aws-cdk-rfcs/issues/375 for details.
type StringOnlyJsonValue =
| string
| { [x: string]: StringOnlyJsonValue }
| Array<StringOnlyJsonValue>;

/**
* Properties to provide a Lambda-backed custom resource
*/
Expand Down Expand Up @@ -57,10 +64,12 @@ export interface CustomResourceProps {

/**
* Properties to pass to the Lambda
* Note that CloudFormation only supports the subset of JSON where the leaf
* nodes are strings. See https://github.com/aws/aws-cdk-rfcs/issues/375 for details.
*
* @default - No properties.
*/
readonly properties?: { [key: string]: any };
readonly properties?: { [key: string]: StringOnlyJsonValue };

/**
* For custom resources, you can specify AWS::CloudFormation::CustomResource
Expand Down
Loading