File: nonPrimitiveUnionIntersection.symbols

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (27 lines) | stat: -rw-r--r-- 1,114 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
=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveUnionIntersection.ts ===
var a: object & string = ""; // error
>a : Symbol(a, Decl(nonPrimitiveUnionIntersection.ts, 0, 3))

var b: object | string = ""; // ok
>b : Symbol(b, Decl(nonPrimitiveUnionIntersection.ts, 1, 3))

var c: object & {} = 123; // error
>c : Symbol(c, Decl(nonPrimitiveUnionIntersection.ts, 2, 3))

a = b; // error
>a : Symbol(a, Decl(nonPrimitiveUnionIntersection.ts, 0, 3))
>b : Symbol(b, Decl(nonPrimitiveUnionIntersection.ts, 1, 3))

b = a; // ok
>b : Symbol(b, Decl(nonPrimitiveUnionIntersection.ts, 1, 3))
>a : Symbol(a, Decl(nonPrimitiveUnionIntersection.ts, 0, 3))

const foo: object & {} = {bar: 'bar'}; // ok
>foo : Symbol(foo, Decl(nonPrimitiveUnionIntersection.ts, 6, 5))
>bar : Symbol(bar, Decl(nonPrimitiveUnionIntersection.ts, 6, 26))

const bar: object & {err: string} = {bar: 'bar'}; // error
>bar : Symbol(bar, Decl(nonPrimitiveUnionIntersection.ts, 7, 5))
>err : Symbol(err, Decl(nonPrimitiveUnionIntersection.ts, 7, 21))
>bar : Symbol(bar, Decl(nonPrimitiveUnionIntersection.ts, 7, 37))