File: readonlyTupleAndArrayElaboration.ts

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (72 lines) | stat: -rw-r--r-- 1,391 bytes parent folder | download | duplicates (4)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// @strict
// #Repro from #30839

let point = [3, 4] as const;

function distanceFromOrigin([x, y]: [number, number]) {
    return Math.sqrt(x ** 2 + y ** 2);
}

distanceFromOrigin(point);

declare function arryFn(x: number[]): void;
arryFn(point);

declare function arryFn2(x: Array<number>): void;
arryFn2(point);

declare const a: readonly number[];
declare const b: Readonly<number[]>;
declare const c: ReadonlyArray<number>;

arryFn2(a);
arryFn2(b);
arryFn2(c);

const t1: readonly [1] = [1];
const t2: readonly [] = t1;

const t3: readonly [1] = [1];
const t4: [] = t3;

const t5: [1] = [1];
const t6: readonly [] = t5;

const t7: [1] = [1];
const t8: [] = t7;

const a1: readonly number[] = [1];
const a2: readonly boolean[] = a1;

const a3: readonly number[] = [1];
const a4: boolean[] = a3;

const a5: number[] = [1];
const a6: readonly boolean [] = a5;

const a7: number[] = [1];
const a8: boolean[] = a7;

const ta1: readonly [1] = [1];
const ta2: readonly boolean[] = ta1;

const ta3: readonly [1] = [1];
const ta4: number[] = ta3;

const ta5: [1] = [1];
const ta6: readonly boolean[] = ta5;

const ta7: [1] = [1];
const ta8: boolean[] = ta7;

const at1: readonly number[] = [1];
const at2: readonly [1] = at1;

const at3: readonly number[] = [1];
const at4: [1] = at3;

const at5: number[] = [1];
const at6: readonly [1] = at5;

const at7: number[] = [1];
const at8: [1] = at7;