File: subtypingWithOptionalProperties.symbols

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 (35 lines) | stat: -rw-r--r-- 1,749 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
=== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithOptionalProperties.ts ===
// subtyping is not transitive due to optional properties but the subtyping algorithm assumes it is for the 99% case

// returns { s?: number; }
function f<T>(a: T) {
>f : Symbol(f, Decl(subtypingWithOptionalProperties.ts, 0, 0))
>T : Symbol(T, Decl(subtypingWithOptionalProperties.ts, 3, 11))
>a : Symbol(a, Decl(subtypingWithOptionalProperties.ts, 3, 14))
>T : Symbol(T, Decl(subtypingWithOptionalProperties.ts, 3, 11))

    var b: { s?: number } = a;
>b : Symbol(b, Decl(subtypingWithOptionalProperties.ts, 4, 7))
>s : Symbol(s, Decl(subtypingWithOptionalProperties.ts, 4, 12))
>a : Symbol(a, Decl(subtypingWithOptionalProperties.ts, 3, 14))

    return b;
>b : Symbol(b, Decl(subtypingWithOptionalProperties.ts, 4, 7))
}

var r = f({ s: new Object() }); // ok
>r : Symbol(r, Decl(subtypingWithOptionalProperties.ts, 8, 3))
>f : Symbol(f, Decl(subtypingWithOptionalProperties.ts, 0, 0))
>s : Symbol(s, Decl(subtypingWithOptionalProperties.ts, 8, 11))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))

r.s && r.s.toFixed(); // would blow up at runtime
>r.s : Symbol(s, Decl(subtypingWithOptionalProperties.ts, 4, 12))
>r : Symbol(r, Decl(subtypingWithOptionalProperties.ts, 8, 3))
>s : Symbol(s, Decl(subtypingWithOptionalProperties.ts, 4, 12))
>r.s.toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --))
>r.s : Symbol(s, Decl(subtypingWithOptionalProperties.ts, 4, 12))
>r : Symbol(r, Decl(subtypingWithOptionalProperties.ts, 8, 3))
>s : Symbol(s, Decl(subtypingWithOptionalProperties.ts, 4, 12))
>toFixed : Symbol(Number.toFixed, Decl(lib.es5.d.ts, --, --))