Skip to content

ExpectTrue

Since 1.4.0

Expect type to be true.

Signature

typescript
type ExpectTrue<T extends true> = T

Parameters

ParameterDescription
TType that should extend true

Description

Type assertion for testing that a type is true.

Examples

Basic Usage

typescript
import type { ExpectTrue, IsEqual } from 'uni-types'

type Test1 = ExpectTrue<IsEqual<string, string>> // OK
type Test2 = ExpectTrue<IsEqual<string, number>> // Error

Released under the MIT License.