File: getAndSetNotIdenticalType2.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (50 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (3)
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
=== tests/cases/compiler/getAndSetNotIdenticalType2.ts ===
class A<T> { foo: T; }
>A : A<T>
>foo : T

class C<T> {
>C : C<T>

    data: A<T>;
>data : A<T>

    get x(): A<T> {
>x : A<T>

        return this.data;
>this.data : A<T>
>this : this
>data : A<T>
    }
    set x(v: A<string>) {
>x : A<T>
>v : A<string>

        this.data = v;
>this.data = v : A<string>
>this.data : A<T>
>this : this
>data : A<T>
>v : A<string>
    }
}

var x = new C();
>x : C<unknown>
>new C() : C<unknown>
>C : typeof C

var r = x.x;
>r : A<unknown>
>x.x : A<unknown>
>x : C<unknown>
>x : A<unknown>

x.x = r;
>x.x = r : A<unknown>
>x.x : A<string>
>x : C<unknown>
>x : A<string>
>r : A<unknown>