File: indirectTypeParameterReferences.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (97 lines) | stat: -rw-r--r-- 3,042 bytes parent folder | download
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
=== tests/cases/compiler/indirectTypeParameterReferences.ts ===
// Repro from #19043

type B = {b: string}
>B : B
>b : string

const flowtypes = <A>(b: B) => {
>flowtypes : <A>(b: B) => { combined: (fn: (combined: A & B) => void) => any; literal: (fn: (aPlusB: A & B) => void) => any; }
><A>(b: B) => {  type Combined = A & B  const combined = (fn: (combined: Combined) => void) => null  const literal = (fn: (aPlusB: A & B) => void) => null  return {combined, literal}} : <A>(b: B) => { combined: (fn: (combined: A & B) => void) => any; literal: (fn: (aPlusB: A & B) => void) => any; }
>b : B

  type Combined = A & B
>Combined : A & B

  const combined = (fn: (combined: Combined) => void) => null
>combined : (fn: (combined: A & B) => void) => any
>(fn: (combined: Combined) => void) => null : (fn: (combined: A & B) => void) => any
>fn : (combined: A & B) => void
>combined : A & B
>null : null

  const literal = (fn: (aPlusB: A & B) => void) => null
>literal : (fn: (aPlusB: A & B) => void) => any
>(fn: (aPlusB: A & B) => void) => null : (fn: (aPlusB: A & B) => void) => any
>fn : (aPlusB: A & B) => void
>aPlusB : A & B
>null : null

  return {combined, literal}
>{combined, literal} : { combined: (fn: (combined: A & B) => void) => any; literal: (fn: (aPlusB: A & B) => void) => any; }
>combined : (fn: (combined: A & B) => void) => any
>literal : (fn: (aPlusB: A & B) => void) => any
}

const {combined, literal} = flowtypes<{a: string}>({b: 'b-value'})
>combined : (fn: (combined: { a: string; } & B) => void) => any
>literal : (fn: (aPlusB: { a: string; } & B) => void) => any
>flowtypes<{a: string}>({b: 'b-value'}) : { combined: (fn: (combined: { a: string; } & B) => void) => any; literal: (fn: (aPlusB: { a: string; } & B) => void) => any; }
>flowtypes : <A>(b: B) => { combined: (fn: (combined: A & B) => void) => any; literal: (fn: (aPlusB: A & B) => void) => any; }
>a : string
>{b: 'b-value'} : { b: string; }
>b : string
>'b-value' : "b-value"

literal(aPlusB => {
>literal(aPlusB => {  aPlusB.b  aPlusB.a}) : any
>literal : (fn: (aPlusB: { a: string; } & B) => void) => any
>aPlusB => {  aPlusB.b  aPlusB.a} : (aPlusB: { a: string; } & B) => void
>aPlusB : { a: string; } & B

  aPlusB.b
>aPlusB.b : string
>aPlusB : { a: string; } & B
>b : string

  aPlusB.a
>aPlusB.a : string
>aPlusB : { a: string; } & B
>a : string

})

combined(comb => {
>combined(comb => {  comb.b  comb.a}) : any
>combined : (fn: (combined: { a: string; } & B) => void) => any
>comb => {  comb.b  comb.a} : (comb: { a: string; } & B) => void
>comb : { a: string; } & B

  comb.b
>comb.b : string
>comb : { a: string; } & B
>b : string

  comb.a
>comb.a : string
>comb : { a: string; } & B
>a : string

})

// Repro from #19091

declare function f<T>(a: T): { a: typeof a };
>f : <T>(a: T) => { a: T; }
>a : T
>a : T
>a : T

let n: number = f(2).a;
>n : number
>f(2).a : number
>f(2) : { a: number; }
>f : <T>(a: T) => { a: T; }
>2 : 2
>a : number