Skip to content

Commit a0fb04f

Browse files
authored
chore(core): change FeatureFlags to use constructs.IConstruct (#19567)
This change is motivated by #18140, where we are running into trouble because the current scope is a `constructs.Construct` but `FeatureFlags.of` required a `core.construct`. ---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/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/master/INTEGRATION_TESTS.md)? * [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-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*
1 parent 64b266f commit a0fb04f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/@aws-cdk/core/lib/feature-flags.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as cxapi from '@aws-cdk/cx-api';
2-
import { IConstruct } from '../lib/construct-compat';
2+
import { IConstruct, Node } from 'constructs';
33

44
/**
55
* Features that are implemented behind a flag in order to preserve backwards
@@ -24,7 +24,7 @@ export class FeatureFlags {
2424
* module.
2525
*/
2626
public isEnabled(featureFlag: string): boolean | undefined {
27-
const context = this.construct.node.tryGetContext(featureFlag);
27+
const context = Node.of(this.construct).tryGetContext(featureFlag);
2828
if (cxapi.FUTURE_FLAGS_EXPIRED.includes(featureFlag)) {
2929
if (context !== undefined) {
3030
throw new Error(`Unsupported feature flag '${featureFlag}'. This flag existed on CDKv1 but has been removed in CDKv2.`

0 commit comments

Comments
 (0)