Skip to content

Commit

Permalink
STYLE.md: document method for testing with private constructors
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Oldsberg <[email protected]>
  • Loading branch information
Rugvip committed Jan 31, 2023
1 parent 7f11883 commit cb72a9c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(/* ... */) {
/* ... */
}
Expand Down

0 comments on commit cb72a9c

Please sign in to comment.