From fcb7231d2239b12c027e573f07d8d01ff357035e Mon Sep 17 00:00:00 2001 From: Xia Zhao <78883180+xazhao@users.noreply.github.com> Date: Thu, 22 Feb 2024 13:56:10 -0800 Subject: [PATCH] chore(appconfig): compilation error in ts 4.2 and below because of using get in interface (#29226) ### Reason for this change There is a lint error which `get` syntax can't be used on interface before TS version 4.3 ### Description of changes Replace `get` with a regular function. ### Description of how you validated changes Unit test passed. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-appconfig/lib/application.ts | 4 ++-- packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/aws-cdk-lib/aws-appconfig/lib/application.ts b/packages/aws-cdk-lib/aws-appconfig/lib/application.ts index 440776ac8a0d2..a2eceecb71f94 100644 --- a/packages/aws-cdk-lib/aws-appconfig/lib/application.ts +++ b/packages/aws-cdk-lib/aws-appconfig/lib/application.ts @@ -72,7 +72,7 @@ export interface IApplication extends cdk.IResource { /** * Returns the list of associated environments. */ - get environments(): IEnvironment[]; + environments(): IEnvironment[]; /** * Adds an extension defined by the action point and event destination @@ -204,7 +204,7 @@ abstract class ApplicationBase extends cdk.Resource implements IApplication, IEx this._environments.push(environment); } - get environments(): IEnvironment[] { + public environments(): IEnvironment[] { return this._environments; } diff --git a/packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts b/packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts index 588ea3c28686c..a974aae0c4203 100644 --- a/packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts +++ b/packages/aws-cdk-lib/aws-appconfig/lib/configuration.ts @@ -304,7 +304,7 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE protected addExistingEnvironmentsToApplication() { this.deployTo?.forEach((environment) => { - if (!this.application.environments.includes(environment)) { + if (!this.application.environments().includes(environment)) { this.application.addExistingEnvironment(environment); } }); @@ -315,7 +315,7 @@ abstract class ConfigurationBase extends Construct implements IConfiguration, IE return; } - this.application.environments.forEach((environment) => { + this.application.environments().forEach((environment) => { if ((this.deployTo && !this.deployTo.includes(environment))) { return; }