Skip to content

Commit 6e0aa13

Browse files
authored
chore: add undefined type to principalAccount (#33055)
### Reason for this change When using TypeScript option exactOptionalPropertyTypes: true` we get the following error. All implementations of `IPrincipal` have the type `string | undefined` so this is change will apply it at the base ``` Type 'AccountPrincipal' is not assignable to type 'IPrincipal' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties. Types of property 'principalAccount' are incompatible. Type 'string | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'.ts(2375) ``` ### Description of changes Changed type definition of IPrincipal `principalAccount` ### Describe any new or updated permissions being added N/A ### Description of how you validated changes ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 759e692 commit 6e0aa13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/aws-cdk-lib/aws-iam/lib/principals.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export interface IPrincipal extends IGrantable {
5353
* Can be a Token - in that case,
5454
* it's assumed to be AWS::AccountId.
5555
*/
56-
readonly principalAccount?: string;
56+
readonly principalAccount?: string | undefined;
5757

5858
/**
5959
* Add to the policy of this principal.

0 commit comments

Comments
 (0)