Skip to main content
Module

x/tsafe/test/exclude.types.ts

🔩 The missing TypeScript utils
Go to Latest
File
/* eslint-disable @typescript-eslint/no-unused-vars *//* eslint-disable @typescript-eslint/ban-ts-comment */import { exclude } from "../exclude.ts";import { doExtends } from "../doExtends.ts";import { Any } from "ts-toolbelt DENOIFY: DEPENDENCY UNMET (DEV DEPENDENCY)";
{ const x = (["a", "b", "c"] as const).filter(exclude(["a"]));
type Got = typeof x; type Expected = ("b" | "c")[];
doExtends<Any.Equals<Got, Expected>, 1>();}
{ const x = (["a", "b", "c", "d"] as const).filter(exclude(["a", "b"]));
type Got = typeof x; type Expected = ("c" | "d")[];
doExtends<Any.Equals<Got, Expected>, 1>();}
{ const x = [3, "a", false].filter(exclude([3]));
type Got = typeof x;
type Expected = (number | string | boolean)[];
doExtends<Any.Equals<Got, Expected>, 1>();}
{ //@ts-expect-error const x = (["a", "b", "c", "d"] as const).filter(exclude("a", "b"));}