From 026e930a10bdf36f165a5c16365eadedbc4594da Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 21 Sep 2022 03:12:11 -0500 Subject: [PATCH] docs(iam): hints at accountId as string type (#22149) ---- ### 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* --- With the merge of [#20292](https://github.com/aws/aws-cdk/pull/20292) the accountID type was essentially required to be a string with the exception of an unencoded token. So, while the type of accountId cannot be set to string and must remain any to preserve compatibility, the hint for accountId should at least suggest that a string should be used rather than an int. --- packages/@aws-cdk/aws-iam/lib/principals.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-iam/lib/principals.ts b/packages/@aws-cdk/aws-iam/lib/principals.ts index 3a411287d6114..9475707b1ad82 100644 --- a/packages/@aws-cdk/aws-iam/lib/principals.ts +++ b/packages/@aws-cdk/aws-iam/lib/principals.ts @@ -459,7 +459,7 @@ export class AccountPrincipal extends ArnPrincipal { /** * - * @param accountId AWS account ID (i.e. 123456789012) + * @param accountId AWS account ID (i.e. '123456789012') */ constructor(public readonly accountId: any) { super(new StackDependentToken(stack => `arn:${stack.partition}:iam::${accountId}:root`).toString()); @@ -936,4 +936,4 @@ export function validateConditionObject(x: unknown): asserts x is Record