Skip to main content
Module

x/ts_toolbelt_unofficial/mod.ts>Any.Cast

👷 TypeScript's largest type utility library, now on Deno
Latest
type alias Any.Cast
import { type Any } from "https://deno.land/x/ts_toolbelt_unofficial@1.1.0/mod.ts";
const { Cast } = Any;

Ask TS to re-check that A1 extends A2. And if it fails, A2 will be enforced anyway. Can also be used to add constraints on parameters.

Examples

Example 1

import {A} from 'ts-toolbelt.ts'

type test0 = A.Cast<'42', string> // '42'
type test1 = A.Cast<'42', number> // number

Type Parameters

A1 extends any
A2 extends any
definition: A1 extends A2 ? A1 : A2