From 4cb8339ae98b2676563dd38085e0f4f3f24b9694 Mon Sep 17 00:00:00 2001 From: go-to-k <24818752+go-to-k@users.noreply.github.com> Date: Wed, 13 Sep 2023 14:54:52 +0900 Subject: [PATCH] change if conditions --- packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts index 61818b47e65f9..37055254e58a2 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts @@ -242,7 +242,7 @@ export class GaugeWidget extends ConcreteWidget { this.metrics = props.metrics ?? []; this.copyMetricWarnings(...this.metrics); - if (props.end && !props.start) { + if (props.end !== undefined && props.start === undefined) { throw new Error('You must specify a start if you specify an end'); } } @@ -435,7 +435,7 @@ export class GraphWidget extends ConcreteWidget { this.rightMetrics = props.right ?? []; this.copyMetricWarnings(...this.leftMetrics, ...this.rightMetrics); - if (props.end && !props.start) { + if (props.end !== undefined && props.start === undefined) { throw new Error('You must specify a start if you specify an end'); } } @@ -573,7 +573,7 @@ export class SingleValueWidget extends ConcreteWidget { throw new Error('You cannot use setPeriodToTimeRange with sparkline'); } - if (props.end && !props.start) { + if (props.end !== undefined && props.start === undefined) { throw new Error('You must specify a start if you specify an end'); } }