-
Notifications
You must be signed in to change notification settings - Fork 0
/
10.ts
29 lines (24 loc) · 839 Bytes
/
10.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
import { Expect, Equal } from "type-testing";
type StreetSuffixTester<
St,
Su extends string,
> = St extends `${infer _ignore}${Su}` ? true : false;
type test_0_actual = StreetSuffixTester<"Candy Cane Way", "Way">;
// ^?
type test_0_expected = true;
type test_0 = Expect<Equal<test_0_expected, test_0_actual>>;
type test_1_actual = StreetSuffixTester<"Chocalate Drive", "Drive">;
// ^?
type test_1_expected = true;
type test_1 = Expect<Equal<test_1_expected, test_1_actual>>;
type test_2_actual = StreetSuffixTester<"Sugar Lane", "Drive">;
// ^?
type test_2_expected = false;
type test_2 = Expect<Equal<test_2_expected, test_2_actual>>;
type test_3_actual = StreetSuffixTester<
"Fifth Dimensional Nebulo 9",
"invalid"
>;
// ^?
type test_3_expected = false;
type test_3 = Expect<Equal<test_3_expected, test_3_actual>>;