Skip to content

Ts.Assert.returned.equiv

Import

typescript
import { Ts } from '@wollybeard/kit'

// Access via namespace
Ts.Assert.returned.equiv
typescript
import { equiv } from '@wollybeard/kit/ts'

Functions

[F] noExcessAs

typescript
<$Type>(): DispatchAfterInput<State.SetExpectedType<State.SetRelator<State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>, EquivNoExcessKind>, $Type>>

[F] ofAs

typescript
<$Type>(): DispatchAfterInput<State.SetExpectedType<State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>, $Type>>

Constants

[C] any

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetAllowAny<
      State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>
    >,
    any
  >
>

[C] bigint

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    bigint
  >
>

[C] boolean

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    boolean
  >
>

[C] Date

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    Date
  >
>

[C] Error

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    Error
  >
>

[C] never

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetAllowNever<
      State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>
    >,
    never
  >
>

[C] noExcess

typescript
InputExpectedAsValueNarrow<
  State.SetRelator<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    EquivNoExcessKind
  >
>

[C] null

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    null
  >
>

[C] number

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    number
  >
>

[C] of

typescript
InputExpectedAsValueNarrow<
  State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>
>

[C] RegExp

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    RegExp
  >
>

[C] string

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    string
  >
>

[C] symbol

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    symbol
  >
>

[C] undefined

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>,
    undefined
  >
>

[C] unknown

typescript
InputActualAsValueNarrow<
  State.SetExpectedType<
    State.SetAllowUnknown<
      State.SetRelator<State.AddExtractor<State.Empty, Returned>, EquivKind>
    >,
    unknown
  >
>

Types

[T] any

typescript
type any_<$Actual> = Kind.Apply<
  EquivKind,
  [any, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for any. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
any
<() => any>
// ✗ Fail type
_
= Assert.returned.equiv.
any
<() => string>

[T] bigint

typescript
type bigint_<$Actual> = Kind.Apply<
  EquivKind,
  [bigint, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for bigint. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
bigint
<() => bigint>
// ✗ Fail type
_
= Assert.returned.equiv.
bigint
<() => string>

[T] boolean

typescript
type boolean_<$Actual> = Kind.Apply<
  EquivKind,
  [boolean, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for boolean. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
boolean
<() => boolean>
// ✗ Fail type
_
= Assert.returned.equiv.
boolean
<() => string>

[T] Date

typescript
type Date_<$Actual> = Kind.Apply<
  EquivKind,
  [Date, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for Date. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
Date
<() => Date>
// ✗ Fail type
_
= Assert.returned.equiv.
Date
<() => string>

[T] Error

typescript
type Error_<$Actual> = Kind.Apply<
  EquivKind,
  [Error, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for Error. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
Error
<() => Error>
// ✗ Fail type
_
= Assert.returned.equiv.
Error
<() => string>

[T] never

typescript
type never_<$Actual> = Kind.Apply<
  EquivKind,
  [never, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for never. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
never
<() => never>
// ✗ Fail type
_
= Assert.returned.equiv.
never
<() => string>

[T] noExcess

typescript
type noExcess_<$Expected, $Actual> = Kind.Apply<
  EquivNoExcessKind,
  [$Expected, Kind.Apply<Path.Returned, [$Actual]>]
>

No-excess variant of equiv relation. Checks that actual has no excess properties beyond expected.

[T] null

typescript
type null_<$Actual> = Kind.Apply<
  EquivKind,
  [null, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for null. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
null
<() => null>
// ✗ Fail type
_
= Assert.returned.equiv.
null
<() => string>

[T] number

typescript
type number_<$Actual> = Kind.Apply<
  EquivKind,
  [number, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for number. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
number
<() => number>
// ✗ Fail type
_
= Assert.returned.equiv.
number
<() => string>

[T] of

typescript
type of_<$Expected, $Actual> = Kind.Apply<
  EquivKind,
  [$Expected, Kind.Apply<Path.Returned, [$Actual]>]
>

returned + equiv relation matchers.

Extraction: extracts the return type from a function Relation: mutual assignability (equivalent types)

[T] RegExp

typescript
type RegExp_<$Actual> = Kind.Apply<
  EquivKind,
  [RegExp, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for RegExp. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
RegExp
<() => RegExp>
// ✗ Fail type
_
= Assert.returned.equiv.
RegExp
<() => string>

[T] string

typescript
type string_<$Actual> = Kind.Apply<
  EquivKind,
  [string, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for string. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
string
<() => string>
// ✗ Fail type
_
= Assert.returned.equiv.
string
<() => number>

[T] symbol

typescript
type symbol_<$Actual> = Kind.Apply<
  EquivKind,
  [symbol, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for symbol. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
symbol
<() => symbol>
// ✗ Fail type
_
= Assert.returned.equiv.
symbol
<() => string>

[T] undefined

typescript
type undefined_<$Actual> = Kind.Apply<
  EquivKind,
  [undefined, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for undefined. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
undefined
<() => undefined>
// ✗ Fail type
_
= Assert.returned.equiv.
undefined
<() => string>

[T] unknown

typescript
type unknown_<$Actual> = Kind.Apply<
  EquivKind,
  [unknown, Kind.Apply<Path.Returned, [$Actual]>]
>

Pre-curried matcher for unknown. Extraction chain: (...args: any[]) = T → T

Examples:

typescript
// ✓ Pass
type 
_
= Assert.returned.equiv.
unknown
<() => unknown>
// ✗ Fail type
_
= Assert.returned.equiv.
unknown
<() => string>