Skip to content

Commit

Permalink
docs(optional): deprecate the cast method
Browse files Browse the repository at this point in the history
  • Loading branch information
dancrumb committed Jul 31, 2024
1 parent fa0b39a commit 2e2a844
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Optional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ export class Optional<T> {
* type checking. This is generally used for up- and down-casting.
*
* @param guard
*
* @deprecated just use `filter` with a type guard
*/
cast<S extends T>(guard: (o: T | S) => boolean): Optional<S> {
if (this.isPresent() && guard(this.get())) {
Expand Down

0 comments on commit 2e2a844

Please sign in to comment.