From cb72a9cc5e8597c80f01cc8d8adcb464a89d02b0 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 31 Jan 2023 13:44:16 +0100 Subject: [PATCH] STYLE.md: document method for testing with private constructors Signed-off-by: Patrik Oldsberg --- STYLE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/STYLE.md b/STYLE.md index 87e0644759..e38354ae1d 100644 --- a/STYLE.md +++ b/STYLE.md @@ -94,6 +94,13 @@ This section describes guidelines for designing public APIs. It can also be appl /* ... */ } + // In order to make a private constructor available for testing you can use a + // static factory marked as `@internal`, which will not show up in the public API. + /** @internal */ + static forTesting(internalOptions?: { ... }) { + return new DefaultImageLoader(internalOptions); + } + private constructor(/* ... */) { /* ... */ }