NotHas

import { NotHas } from "jsr:@ende/testing/types";

type alias

type NotHas<T, U> = Has<T, U> extends false ? true : false

Checks if type T does not have the specified type U.

Example: Usage

import { assertType, NotHas } from "@ende/testing/types";

assertType<NotHas<string | number, Date>>(true);
assertType<NotHas<string, number>>(true);
assertType<NotHas<number, any>>(true);

assertType<NotHas<string | number, string>>(false);
assertType<NotHas<any, number>>(false);

Source