Type alias unstable_Matchable<narrowedOrFn, input, pattern>Experimental

unstable_Matchable<narrowedOrFn, input, pattern>: CustomP<input, pattern, narrowedOrFn>

A Matchable is an object implementing the Matcher Protocol. It must have a [P.matcher]: P.Matcher<NarrowFn> key, which defines how this object should be matched by TS-Pattern.

Note that this api is unstable.

Type Parameters

  • narrowedOrFn
  • input = unknown
  • pattern = never

Example

class Some<T> implements P.unstable_Matchable {
[P.matcher](): P.unstable_Matcher<Some<T>>
}