From b9564d59bdd4ec47a41371dbd1901d3f16358cb8 Mon Sep 17 00:00:00 2001 From: Christian Habermehl <13348120+schabe77@users.noreply.github.com> Date: Tue, 14 Jun 2022 00:43:55 +0200 Subject: [PATCH] chore(core): IConstruct is passed to Names.uniqueId instead of Construct (#20584) (#20696) This updates `Names.uniqueId()` to accept an `IConstruct` instead of `Construct`. Closes #20584 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/core/lib/names.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/core/lib/names.ts b/packages/@aws-cdk/core/lib/names.ts index e68b43b137bf0..ea75927acb5ed 100644 --- a/packages/@aws-cdk/core/lib/names.ts +++ b/packages/@aws-cdk/core/lib/names.ts @@ -1,4 +1,4 @@ -import { Construct, Node } from 'constructs'; +import { IConstruct, Node } from 'constructs'; import { makeUniqueId } from './private/uniqueid'; /** @@ -14,7 +14,7 @@ export class Names { * @param construct The construct * @returns a unique id based on the construct path */ - public static uniqueId(construct: Construct): string { + public static uniqueId(construct: IConstruct): string { const node = Node.of(construct); const components = node.scopes.slice(1).map(c => Node.of(c).id); return components.length > 0 ? makeUniqueId(components) : '';