File: exportAssignmentConstrainedGenericType.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 (44 lines) | stat: -rw-r--r-- 920 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
=== tests/cases/conformance/externalModules/foo_1.ts ===
import foo = require("./foo_0");
>foo : typeof foo

var x = new foo(true); // Should error
>x : any
>new foo(true) : any
>foo : typeof foo
>true : true

var y = new foo({a: "test", b: 42}); // Should be OK
>y : foo<{ a: string; b: number; }>
>new foo({a: "test", b: 42}) : foo<{ a: string; b: number; }>
>foo : typeof foo
>{a: "test", b: 42} : { a: string; b: number; }
>a : string
>"test" : "test"
>b : number
>42 : 42

var z: number = y.test.b;
>z : number
>y.test.b : number
>y.test : { a: string; b: number; }
>y : foo<{ a: string; b: number; }>
>test : { a: string; b: number; }
>b : number

=== tests/cases/conformance/externalModules/foo_0.ts ===
class Foo<T extends {a: string; b:number;}>{
>Foo : Foo<T>
>a : string
>b : number

	test: T;
>test : T

	constructor(x: T){}
>x : T
}

export = Foo;
>Foo : Foo<T>