From ef8f0cd7e137f1e007601ebf143c051a8d5905a1 Mon Sep 17 00:00:00 2001 From: Dan Mirsky Date: Mon, 5 Aug 2019 08:54:21 -0700 Subject: [PATCH] docs(core): findChild gets direct child only (#3512) --- packages/@aws-cdk/core/lib/construct.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/packages/@aws-cdk/core/lib/construct.ts b/packages/@aws-cdk/core/lib/construct.ts index 1fc8a85cd3299..87dbffe7f16ca 100644 --- a/packages/@aws-cdk/core/lib/construct.ts +++ b/packages/@aws-cdk/core/lib/construct.ts @@ -181,20 +181,17 @@ export class ConstructNode { } /** - * Return a descendant by path + * Return a direct child by id * - * Throws an error if the descendant is not found. + * Throws an error if the child is not found. * - * Note that if the original ID of the construct you are looking for contained - * a '/', then it would have been replaced by '--'. - * - * @param path Relative path of a direct or indirect child - * @returns Child with the given path. + * @param id Identifier of direct child + * @returns Child with the given id. */ - public findChild(path: string): IConstruct { - const ret = this.tryFindChild(path); + public findChild(id: string): IConstruct { + const ret = this.tryFindChild(id); if (!ret) { - throw new Error(`No child with path: '${path}'`); + throw new Error(`No child with id: '${id}'`); } return ret; }