Skip to content

Commit

Permalink
chore(core): IConstruct is passed to Names.uniqueId instead of Constr…
Browse files Browse the repository at this point in the history
…uct (#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:/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https:/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https:/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*
  • Loading branch information
schabe77 authored Jun 13, 2022
1 parent f69e92e commit f98029e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/core/lib/names.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Construct, Node } from 'constructs';
import { IConstruct, Node } from 'constructs';
import { makeUniqueId } from './private/uniqueid';

/**
Expand All @@ -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) : '';
Expand Down

0 comments on commit f98029e

Please sign in to comment.