Debian Codegraph @

type-fest/test-d/literal-to-primitive-deep.ts

raw symbols SCIP
1 import {expectType} from 'tsd';
2 import type {IsEqual, LiteralToPrimitiveDeep} from '../index.d.ts';
3
4 type LiteralObject = {
5 a: string;
6 b: number;
7 c: boolean;
8 d: {
9 e: bigint;
10 f: symbol;
11 g: {
12 h: string[];
13 i: {
14 j: boolean;
15 k: {
16 l: 1;
17 m: 'hello';
18 o: [1, 2, 3];
19 p: ['a', 'b', 'c'];
20 q: [1, 'a', true];
21 };
22 };
23 };
24 };
25 };
26
27 type PrimitiveObject = {
28 a: string;
29 b: number;
30 c: boolean;
31 d: {
32 e: bigint;
33 f: symbol;
34 g: {
35 h: string[];
36 i: {
37 j: boolean;
38 k: {
39 l: number;
40 m: string;
41 o: number[];
42 p: string[];
43 q: Array<number | string | boolean>;
44 };
45 };
46 };
47 };
48 };
49
50 const typeEqual: IsEqual<
51 LiteralToPrimitiveDeep<LiteralObject>,
52 PrimitiveObject
53 > = true;
54 expectType<true>(typeEqual);