Skip to content

(cloudwatch): TypeScript declarations missing for CreateAlarmOptionsBase in v2.232.0 #36310

@isnoto

Description

@isnoto

Please add your +1 👍 to let us know you have encountered this

Status: IN-PROGRESS

Overview:

A recent change (#36270 ) released in v2.232.0 to strip internal types (example: CreateAlarmOptionsBase) breaks external-facing types (example: CreateAlarmOptions) which extend the internal types, resulting in missing properties (example: evaluationPeriods, which is a property of the internal CreateAlarmOptionsBase type).

Complete Error Message:

error TS2353: Object literal may only specify known properties, and 'evaluationPeriods' does not exist in type 'AlarmProps'.

Workaround:

Use v2.231.0

Solution:

We are reverting the change introduced in v2.232.0 and will release it as a patch v2.232.1

Related Issues:

None


Original issue

Describe the bug

The file aws-cloudwatch/lib/private/alarm-options.d.ts in aws-cdk-lib@2.232.0 is empty (export {}), causing TypeScript errors when creating CloudWatch Alarms.

Properties like evaluationPeriods, alarmName, and datapointsToAlarm are reported as not existing in AlarmProps, even though they are documented and the JavaScript implementation uses them correctly.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

v2.231.0

Expected Behavior

The .d.ts file should contain the CreateAlarmOptionsBase interface with all alarm properties (evaluationPeriods, alarmName, datapointsToAlarm, etc.) as it does in v2.231.0.

Current Behavior

TypeScript compilation fails with:

error TS2353: Object literal may only specify known properties,
and 'evaluationPeriods' does not exist in type 'AlarmProps'.

Reproduction Steps

# Download fresh package from npm
npm pack aws-cdk-lib@2.232.0
tar -xzf aws-cdk-lib-2.232.0.tgz

#Check the broken file
cat package/aws-cloudwatch/lib/private/alarm-options.d.ts
# Output: export {};

#### Compare with working version
npm pack aws-cdk-lib@2.231.0
tar -xzf aws-cdk-lib-2.231.0.tgz -C pkg-2.231 --strip-components=0
cat pkg-2.231/aws-cloudwatch/lib/private/alarm-options.d.ts
# Output: Full CreateAlarmOptionsBase interface

Possible Solution

Pin to the last working version:

npm install aws-cdk-lib@2.231.0

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

2.232.0

AWS CDK CLI version

2.1033.0

Node.js Version

v24.11.1

OS

MacOS

Language

TypeScript

Language Version

TypeScript (5.9.3)

Other information

No response

Metadata

Metadata

Labels

@aws-cdk/aws-cloudwatchRelated to Amazon CloudWatchbugThis issue is a bug.p0potential-regressionMarking this issue as a potential regression to be checked by team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions