Skip to content

Commit

Permalink
fix(cloudformation): nested stack example in readme is broken (#5729)
Browse files Browse the repository at this point in the history
Use `this` instead of `scope` and make `props` optional.

Fixes #5686

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Elad Ben-Israel and mergify[bot] committed Jan 9, 2020
1 parent 99f3605 commit c53356a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-cloudformation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ import cfn = require('@aws-cdk/aws-cloudformation');
import s3 = require('@aws-cdk/aws-s3');

class MyNestedStack extends cfn.NestedStack {
constructor(scope: Construct, id: string, props: cfn.NestedStackProps) {
constructor(scope: Construct, id: string, props?: cfn.NestedStackProps) {
super(scope, id, props);

new s3.Bucket(this, 'NestedBucket');
}
}

class MyParentStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps) {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);

new MyNestedStack(scope, 'Nested1');
new MyNestedStack(scope, 'Nested2');
new MyNestedStack(this, 'Nested1');
new MyNestedStack(this, 'Nested2');
}
}
```
Expand Down

0 comments on commit c53356a

Please sign in to comment.