import * as cdk from 'aws-cdk-lib';
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'MyStack');
const secret = new secretsmanager.Secret(stack, 'MySecret', {});
secret.arnForPolicies;
Running with npx ts-node gives:
error TS2445: Property 'arnForPolicies' is protected and only accessible within class 'SecretBase' and its subclasses.
6 secret.arnForPolicies;
~~~~~~~~~~~~~~
I think it does make sense for any protected properties (and methods) to be included in the docs, as I might rely on them in a subclass I write, but the docs should mark them as protected, or otherwise make it clear that they aren't public.
Describe the issue
Some examples:
aws-cdk-lib.aws_secretsmanager.Secret,
arnForPolicies
Docs: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html#properties (note that
arnForPolicies
is not marked asprotected
anywhere in the table) Specific property (arnForPolicies
): not noted in the docs for the property either https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html#arnforpolicies Code: https://github.com/aws/aws-cdk/blob/v2.85.0/packages/aws-cdk-lib/aws-secretsmanager/lib/secret.ts#L452 Usage:Running with
npx ts-node
gives:aws-cdk-lib.aws_dynamodb.Table,
hasIndex
Docs: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html#properties (note that
hasIndex
is not marked asprotected
anywhere in the table) Specific property: (hasIndex
): not noted in the docs for the property either https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html#hasindex Code: https://github.com/aws/aws-cdk/blob/v2.85.0/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts#L1723 Usage:Running with
npx ts-node
gives:Probably affects all (or many) of https://github.com/search?q=repo%3Aaws%2Faws-cdk+%22protected+get%22&type=code as the root cause appears to be something in the docs generation.
I think it does make sense for any protected properties (and methods) to be included in the docs, as I might rely on them in a subclass I write, but the docs should mark them as protected, or otherwise make it clear that they aren't public.
Links
And probably all of: