File: overrideBaseIntersectionMethod.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 (95 lines) | stat: -rw-r--r-- 2,905 bytes parent folder | download | duplicates (5)
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
=== tests/cases/compiler/overrideBaseIntersectionMethod.ts ===
// Repro from #14615

type Constructor<T> = new (...args: any[]) => T;
>Constructor : Constructor<T>
>args : any[]

const WithLocation = <T extends Constructor<Point>>(Base: T) => class extends Base {
>WithLocation : <T extends Constructor<Point>>(Base: T) => { new (...args: any[]): (Anonymous class); prototype: WithLocation<any>.(Anonymous class); } & T
><T extends Constructor<Point>>(Base: T) => class extends Base {  getLocation(): [number, number] {    const [x,y] = super.getLocation();    return [this.x | x, this.y | y];  }} : <T extends Constructor<Point>>(Base: T) => { new (...args: any[]): (Anonymous class); prototype: WithLocation<any>.(Anonymous class); } & T
>Base : T
>class extends Base {  getLocation(): [number, number] {    const [x,y] = super.getLocation();    return [this.x | x, this.y | y];  }} : { new (...args: any[]): (Anonymous class); prototype: WithLocation<any>.(Anonymous class); } & T
>Base : Point

  getLocation(): [number, number] {
>getLocation : () => [number, number]

    const [x,y] = super.getLocation();
>x : number
>y : number
>super.getLocation() : [number, number]
>super.getLocation : () => [number, number]
>super : Point
>getLocation : () => [number, number]

    return [this.x | x, this.y | y];
>[this.x | x, this.y | y] : [number, number]
>this.x | x : number
>this.x : number
>this : this
>x : number
>x : number
>this.y | y : number
>this.y : number
>this : this
>y : number
>y : number
  }
}

class Point {
>Point : Point

  constructor(public x: number, public y: number) { }
>x : number
>y : number

  getLocation(): [number, number] {
>getLocation : () => [number, number]

    return [0,0];
>[0,0] : [number, number]
>0 : 0
>0 : 0
  }
}

class Foo extends WithLocation(Point) {
>Foo : Foo
>WithLocation(Point) : WithLocation<typeof Point>.(Anonymous class) & Point
>WithLocation : <T extends Constructor<Point>>(Base: T) => { new (...args: any[]): (Anonymous class); prototype: WithLocation<any>.(Anonymous class); } & T
>Point : typeof Point

  calculate() {
>calculate : () => number

    return this.x + this.y;
>this.x + this.y : number
>this.x : number
>this : this
>x : number
>this.y : number
>this : this
>y : number
  }
  getLocation() {
>getLocation : () => [number, number]

    return super.getLocation()
>super.getLocation() : [number, number]
>super.getLocation : (() => [number, number]) & (() => [number, number])
>super : WithLocation<typeof Point>.(Anonymous class) & Point
>getLocation : (() => [number, number]) & (() => [number, number])
  }
  whereAmI() {
>whereAmI : () => [number, number]

    return this.getLocation();
>this.getLocation() : [number, number]
>this.getLocation : () => [number, number]
>this : this
>getLocation : () => [number, number]
  }
}