Link Search Menu Expand Document

index overview

Added in v1.0.0


Table of contents


utils

All (type alias)

Signature

export type All<BS extends boolean[]> = ImplAll<BS>

Example

import { All } from 'ts-typelevel-boolean'
import { assert as typeAssert } from 'conditional-type-checks'

typeAssert<All<[true, true, true]>>(true)
typeAssert<All<[true, false, true]>>(false)
typeAssert<All<[false, false, false]>>(false)

And (type alias)

Signature

export type And<B1 extends boolean, B2 extends boolean> = ImplAnd<B1, B2>

Example

import { And } from 'ts-typelevel-boolean'
import { assert as typeAssert } from 'conditional-type-checks'

typeAssert<And<false, false>>(false)
typeAssert<And<false, true>>(false)
typeAssert<And<true, false>>(false)
typeAssert<And<true, true>>(true)

If (type alias)

Signature

export type If<B extends boolean, T, E> = ImplIf<B, T, E>

Example

import { If } from 'ts-typelevel-boolean'
import { assert as typeAssert, IsExact } from 'conditional-type-checks'

typeAssert<IsExact<If<true, 'A', 'B'>, 'A'>>(true)
typeAssert<IsExact<If<false, 'A', 'B'>, 'B'>>(true)

IfNot (type alias)

Signature

export type IfNot<B extends boolean, T, E> = ImplIfNot<B, T, E>

Example

import { IfNot } from 'ts-typelevel-boolean'
import { assert as typeAssert, IsExact } from 'conditional-type-checks'

typeAssert<IsExact<IfNot<true, 'A', 'B'>, 'B'>>(true)
typeAssert<IsExact<IfNot<false, 'A', 'B'>, 'A'>>(true)

Not (type alias)

Signature

export type Not<B extends boolean> = ImplNot<B>

Example

import { Not } from 'ts-typelevel-boolean'
import { assert as typeAssert } from 'conditional-type-checks'

typeAssert<Not<true>>(false)
typeAssert<Not<false>>(true)

Or (type alias)

Signature

export type Or<B1 extends boolean, B2 extends boolean> = ImplOr<B1, B2>

Example

import { Or } from 'ts-typelevel-boolean'
import { assert as typeAssert } from 'conditional-type-checks'

typeAssert<Or<false, false>>(false)
typeAssert<Or<false, true>>(true)
typeAssert<Or<true, false>>(true)
typeAssert<Or<true, true>>(true)

Some (type alias)

Signature

export type Some<BS extends boolean[]> = ImplSome<BS>

Example

import { Some } from 'ts-typelevel-boolean'
import { assert as typeAssert } from 'conditional-type-checks'

typeAssert<Some<[true, true, true]>>(true)
typeAssert<Some<[true, false, true]>>(true)
typeAssert<Some<[false, false, false]>>(false)

Xor (type alias)

Signature

export type Xor<B1 extends boolean, B2 extends boolean> = ImplXor<B1, B2>

Example

import { Xor } from 'ts-typelevel-boolean'
import { assert as typeAssert } from 'conditional-type-checks'

typeAssert<Xor<false, false>>(false)
typeAssert<Xor<false, true>>(true)
typeAssert<Xor<true, false>>(true)
typeAssert<Xor<true, true>>(false)