generated from garronej/ts-ci
-
Notifications
You must be signed in to change notification settings - Fork 6
/
exclude.types.ts
38 lines (27 loc) · 856 Bytes
/
exclude.types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { exclude } from "../exclude.ts";
import { assert } from "../assert.ts";
import type { Equals } from "../Equals.ts";
{
const x = (["a", "b", "c"] as const).filter(exclude(["a"]));
type Got = typeof x;
type Expected = ("b" | "c")[];
assert<Equals<Got, Expected>>();
}
{
const x = (["a", "b", "c", "d"] as const).filter(exclude(["a", "b"]));
type Got = typeof x;
type Expected = ("c" | "d")[];
assert<Equals<Got, Expected>>();
}
{
const x = [3, "a", false].filter(exclude([3]));
type Got = typeof x;
type Expected = (number | string | boolean)[];
assert<Equals<Got, Expected>>();
}
{
//@ts-expect-error
const x = (["a", "b", "c", "d"] as const).filter(exclude("a", "b"));
}