STYLE.md: document method for testing with private constructors

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-31 13:44:16 +01:00
parent 7f11883e24
commit cb72a9cc5e
+7
View File
@@ -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(/* ... */) {
/* ... */
}