Test case for paren type annotation

This commit is contained in:
Sheetal Nandi 2014-11-10 17:08:50 -08:00
parent 68a07ed0a9
commit c2188a329d
3 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,32 @@
//// [declFileTypeAnnotationParenType.ts]
class c {
private p: string;
}
var x: (() => c)[] = [() => new c()];
var y = [() => new c()];
var k: (() => c) | string = (() => new c()) || "";
var l = (() => new c()) || "";
//// [declFileTypeAnnotationParenType.js]
var c = (function () {
function c() {
}
return c;
})();
var x = [function () { return new c(); }];
var y = [function () { return new c(); }];
var k = (function () { return new c(); }) || "";
var l = (function () { return new c(); }) || "";
//// [declFileTypeAnnotationParenType.d.ts]
declare class c {
private p;
}
declare var x: (() => c)[];
declare var y: (() => c)[];
declare var k: (() => c) | string;
declare var l: string | (() => c);

View file

@ -0,0 +1,41 @@
=== tests/cases/compiler/declFileTypeAnnotationParenType.ts ===
class c {
>c : c
private p: string;
>p : string
}
var x: (() => c)[] = [() => new c()];
>x : (() => c)[]
>c : c
>[() => new c()] : (() => c)[]
>() => new c() : () => c
>new c() : c
>c : typeof c
var y = [() => new c()];
>y : (() => c)[]
>[() => new c()] : (() => c)[]
>() => new c() : () => c
>new c() : c
>c : typeof c
var k: (() => c) | string = (() => new c()) || "";
>k : string | (() => c)
>c : c
>(() => new c()) || "" : string | (() => c)
>(() => new c()) : () => c
>() => new c() : () => c
>new c() : c
>c : typeof c
var l = (() => new c()) || "";
>l : string | (() => c)
>(() => new c()) || "" : string | (() => c)
>(() => new c()) : () => c
>() => new c() : () => c
>new c() : c
>c : typeof c

View file

@ -0,0 +1,12 @@
// @target: ES5
// @declaration: true
class c {
private p: string;
}
var x: (() => c)[] = [() => new c()];
var y = [() => new c()];
var k: (() => c) | string = (() => new c()) || "";
var l = (() => new c()) || "";