Additional tests

This commit is contained in:
Ron Buckton 2015-12-01 14:48:53 -08:00
parent 88a43ccb4a
commit 316ab1e749
7 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,10 @@
tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts(3,16): error TS1055: Type 'PromiseAlias' is not a valid async function return type.
==== tests/cases/conformance/async/es6/asyncAliasReturnType_es6.ts (1 errors) ====
type PromiseAlias<T> = Promise<T>;
async function f(): PromiseAlias<void> {
~
!!! error TS1055: Type 'PromiseAlias' is not a valid async function return type.
}

View file

@ -0,0 +1,11 @@
//// [asyncAliasReturnType_es6.ts]
type PromiseAlias<T> = Promise<T>;
async function f(): PromiseAlias<void> {
}
//// [asyncAliasReturnType_es6.js]
function f() {
return __awaiter(this, void 0, PromiseAlias, function* () {
});
}

View file

@ -0,0 +1,20 @@
//// [asyncQualifiedReturnType_es6.ts]
namespace X {
export class MyPromise<T> extends Promise<T> {
}
}
async function f(): X.MyPromise<void> {
}
//// [asyncQualifiedReturnType_es6.js]
var X;
(function (X) {
class MyPromise extends Promise {
}
X.MyPromise = MyPromise;
})(X || (X = {}));
function f() {
return __awaiter(this, void 0, X.MyPromise, function* () {
});
}

View file

@ -0,0 +1,17 @@
=== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts ===
namespace X {
>X : Symbol(X, Decl(asyncQualifiedReturnType_es6.ts, 0, 0))
export class MyPromise<T> extends Promise<T> {
>MyPromise : Symbol(MyPromise, Decl(asyncQualifiedReturnType_es6.ts, 0, 13))
>T : Symbol(T, Decl(asyncQualifiedReturnType_es6.ts, 1, 27))
>Promise : Symbol(Promise, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
>T : Symbol(T, Decl(asyncQualifiedReturnType_es6.ts, 1, 27))
}
}
async function f(): X.MyPromise<void> {
>f : Symbol(f, Decl(asyncQualifiedReturnType_es6.ts, 3, 1))
>X : Symbol(X, Decl(asyncQualifiedReturnType_es6.ts, 0, 0))
>MyPromise : Symbol(X.MyPromise, Decl(asyncQualifiedReturnType_es6.ts, 0, 13))
}

View file

@ -0,0 +1,17 @@
=== tests/cases/conformance/async/es6/asyncQualifiedReturnType_es6.ts ===
namespace X {
>X : typeof X
export class MyPromise<T> extends Promise<T> {
>MyPromise : MyPromise<T>
>T : T
>Promise : Promise<T>
>T : T
}
}
async function f(): X.MyPromise<void> {
>f : () => X.MyPromise<void>
>X : any
>MyPromise : X.MyPromise<T>
}

View file

@ -0,0 +1,6 @@
// @target: ES6
// @noEmitHelpers: true
type PromiseAlias<T> = Promise<T>;
async function f(): PromiseAlias<void> {
}

View file

@ -0,0 +1,9 @@
// @target: ES6
// @noEmitHelpers: true
namespace X {
export class MyPromise<T> extends Promise<T> {
}
}
async function f(): X.MyPromise<void> {
}