mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Cleanup ES2017 async tests
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
//// [asyncAliasReturnType_es2017.ts]
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
}
|
||||
|
||||
//// [asyncAliasReturnType_es2017.js]
|
||||
async function f() {
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
=== tests/cases/conformance/async/es2017/asyncAliasReturnType_es2017.ts ===
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es2017.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(asyncAliasReturnType_es2017.ts, 0, 18))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(asyncAliasReturnType_es2017.ts, 0, 18))
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
>f : Symbol(f, Decl(asyncAliasReturnType_es2017.ts, 0, 34))
|
||||
>PromiseAlias : Symbol(PromiseAlias, Decl(asyncAliasReturnType_es2017.ts, 0, 0))
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
=== tests/cases/conformance/async/es2017/asyncAliasReturnType_es2017.ts ===
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
>PromiseAlias : Promise<T>
|
||||
>T : T
|
||||
>Promise : Promise<T>
|
||||
>T : T
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
>f : () => Promise<void>
|
||||
>PromiseAlias : Promise<T>
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncClass_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncClass_es2017.ts (1 errors) ====
|
||||
async class C {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [asyncClass_es2017.ts]
|
||||
async class C {
|
||||
}
|
||||
|
||||
//// [asyncClass_es2017.js]
|
||||
async class C {
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncConstructor_es2017.ts(2,3): error TS1089: 'async' modifier cannot appear on a constructor declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncConstructor_es2017.ts (1 errors) ====
|
||||
class C {
|
||||
async constructor() {
|
||||
~~~~~
|
||||
!!! error TS1089: 'async' modifier cannot appear on a constructor declaration.
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [asyncConstructor_es2017.ts]
|
||||
class C {
|
||||
async constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncConstructor_es2017.js]
|
||||
class C {
|
||||
async constructor() {
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncDeclare_es2017.ts(1,9): error TS1040: 'async' modifier cannot be used in an ambient context.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncDeclare_es2017.ts (1 errors) ====
|
||||
declare async function foo(): Promise<void>;
|
||||
~~~~~
|
||||
!!! error TS1040: 'async' modifier cannot be used in an ambient context.
|
||||
@@ -1,4 +0,0 @@
|
||||
//// [asyncDeclare_es2017.ts]
|
||||
declare async function foo(): Promise<void>;
|
||||
|
||||
//// [asyncDeclare_es2017.js]
|
||||
@@ -1,9 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncEnum_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncEnum_es2017.ts (1 errors) ====
|
||||
async enum E {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
Value
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
//// [asyncEnum_es2017.ts]
|
||||
async enum E {
|
||||
Value
|
||||
}
|
||||
|
||||
//// [asyncEnum_es2017.js]
|
||||
var E;
|
||||
(function (E) {
|
||||
E[E["Value"] = 0] = "Value";
|
||||
})(E || (E = {}));
|
||||
@@ -1,48 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(6,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(7,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(8,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(9,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(10,23): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(17,16): error TS1059: Return expression in async function does not have a valid callable 'then' member.
|
||||
tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts(23,25): error TS1058: Operand for 'await' does not have a valid callable 'then' member.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/functionDeclarations/asyncFunctionDeclaration15_es2017.ts (7 errors) ====
|
||||
declare class Thenable { then(): void; }
|
||||
declare let a: any;
|
||||
declare let obj: { then: string; };
|
||||
declare let thenable: Thenable;
|
||||
async function fn1() { } // valid: Promise<void>
|
||||
async function fn2(): { } { } // error
|
||||
~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
async function fn3(): any { } // error
|
||||
~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
async function fn4(): number { } // error
|
||||
~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
async function fn5(): PromiseLike<void> { } // error
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
async function fn6(): Thenable { } // error
|
||||
~~~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
async function fn7() { return; } // valid: Promise<void>
|
||||
async function fn8() { return 1; } // valid: Promise<number>
|
||||
async function fn9() { return null; } // valid: Promise<any>
|
||||
async function fn10() { return undefined; } // valid: Promise<any>
|
||||
async function fn11() { return a; } // valid: Promise<any>
|
||||
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
|
||||
async function fn13() { return thenable; } // error
|
||||
~~~~
|
||||
!!! error TS1059: Return expression in async function does not have a valid callable 'then' member.
|
||||
async function fn14() { await 1; } // valid: Promise<void>
|
||||
async function fn15() { await null; } // valid: Promise<void>
|
||||
async function fn16() { await undefined; } // valid: Promise<void>
|
||||
async function fn17() { await a; } // valid: Promise<void>
|
||||
async function fn18() { await obj; } // valid: Promise<void>
|
||||
async function fn19() { await thenable; } // error
|
||||
~~~~~~~~~~~~~~
|
||||
!!! error TS1058: Operand for 'await' does not have a valid callable 'then' member.
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
//// [asyncFunctionDeclaration15_es2017.ts]
|
||||
declare class Thenable { then(): void; }
|
||||
declare let a: any;
|
||||
declare let obj: { then: string; };
|
||||
declare let thenable: Thenable;
|
||||
async function fn1() { } // valid: Promise<void>
|
||||
async function fn2(): { } { } // error
|
||||
async function fn3(): any { } // error
|
||||
async function fn4(): number { } // error
|
||||
async function fn5(): PromiseLike<void> { } // error
|
||||
async function fn6(): Thenable { } // error
|
||||
async function fn7() { return; } // valid: Promise<void>
|
||||
async function fn8() { return 1; } // valid: Promise<number>
|
||||
async function fn9() { return null; } // valid: Promise<any>
|
||||
async function fn10() { return undefined; } // valid: Promise<any>
|
||||
async function fn11() { return a; } // valid: Promise<any>
|
||||
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
|
||||
async function fn13() { return thenable; } // error
|
||||
async function fn14() { await 1; } // valid: Promise<void>
|
||||
async function fn15() { await null; } // valid: Promise<void>
|
||||
async function fn16() { await undefined; } // valid: Promise<void>
|
||||
async function fn17() { await a; } // valid: Promise<void>
|
||||
async function fn18() { await obj; } // valid: Promise<void>
|
||||
async function fn19() { await thenable; } // error
|
||||
|
||||
|
||||
//// [asyncFunctionDeclaration15_es2017.js]
|
||||
async function fn1() { } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn2() { } // error
|
||||
// error
|
||||
async function fn3() { } // error
|
||||
// error
|
||||
async function fn4() { } // error
|
||||
// error
|
||||
async function fn5() { } // error
|
||||
// error
|
||||
async function fn6() { } // error
|
||||
// error
|
||||
async function fn7() { return; } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn8() { return 1; } // valid: Promise<number>
|
||||
// valid: Promise<number>
|
||||
async function fn9() { return null; } // valid: Promise<any>
|
||||
// valid: Promise<any>
|
||||
async function fn10() { return undefined; } // valid: Promise<any>
|
||||
// valid: Promise<any>
|
||||
async function fn11() { return a; } // valid: Promise<any>
|
||||
// valid: Promise<any>
|
||||
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
|
||||
// valid: Promise<{ then: string; }>
|
||||
async function fn13() { return thenable; } // error
|
||||
// error
|
||||
async function fn14() { await 1; } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn15() { await null; } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn16() { await undefined; } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn17() { await a; } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn18() { await obj; } // valid: Promise<void>
|
||||
// valid: Promise<void>
|
||||
async function fn19() { await thenable; } // error
|
||||
@@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncGetter_es2017.ts(2,3): error TS1042: 'async' modifier cannot be used here.
|
||||
tests/cases/conformance/async/es2017/asyncGetter_es2017.ts(2,13): error TS2378: A 'get' accessor must return a value.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncGetter_es2017.ts (2 errors) ====
|
||||
class C {
|
||||
async get foo() {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
~~~
|
||||
!!! error TS2378: A 'get' accessor must return a value.
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [asyncGetter_es2017.ts]
|
||||
class C {
|
||||
async get foo() {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncGetter_es2017.js]
|
||||
class C {
|
||||
async get foo() {
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/test.ts(3,25): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/task.ts (0 errors) ====
|
||||
export class Task<T> extends Promise<T> { }
|
||||
|
||||
==== tests/cases/conformance/async/es2017/test.ts (1 errors) ====
|
||||
import { Task } from "./task";
|
||||
class Test {
|
||||
async example<T>(): Task<T> { return; }
|
||||
~~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
//// [tests/cases/conformance/async/es2017/asyncImportedPromise_es2017.ts] ////
|
||||
|
||||
//// [task.ts]
|
||||
export class Task<T> extends Promise<T> { }
|
||||
|
||||
//// [test.ts]
|
||||
import { Task } from "./task";
|
||||
class Test {
|
||||
async example<T>(): Task<T> { return; }
|
||||
}
|
||||
|
||||
//// [task.js]
|
||||
"use strict";
|
||||
class Task extends Promise {
|
||||
}
|
||||
exports.Task = Task;
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
class Test {
|
||||
async example() { return; }
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncInterface_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncInterface_es2017.ts (1 errors) ====
|
||||
async interface I {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
//// [asyncInterface_es2017.ts]
|
||||
async interface I {
|
||||
}
|
||||
|
||||
//// [asyncInterface_es2017.js]
|
||||
@@ -1,8 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncModule_es2017.ts(1,1): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncModule_es2017.ts (1 errors) ====
|
||||
async module M {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
//// [asyncModule_es2017.ts]
|
||||
async module M {
|
||||
}
|
||||
|
||||
//// [asyncModule_es2017.js]
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [tests/cases/conformance/async/es2017/asyncMultiFile_es2017.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
async function f() {}
|
||||
//// [b.ts]
|
||||
function g() { }
|
||||
|
||||
//// [a.js]
|
||||
async function f() { }
|
||||
//// [b.js]
|
||||
function g() { }
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/async/es2017/a.ts ===
|
||||
async function f() {}
|
||||
>f : Symbol(f, Decl(a.ts, 0, 0))
|
||||
|
||||
=== tests/cases/conformance/async/es2017/b.ts ===
|
||||
function g() { }
|
||||
>g : Symbol(g, Decl(b.ts, 0, 0))
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
=== tests/cases/conformance/async/es2017/a.ts ===
|
||||
async function f() {}
|
||||
>f : () => Promise<void>
|
||||
|
||||
=== tests/cases/conformance/async/es2017/b.ts ===
|
||||
function g() { }
|
||||
>g : () => void
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncQualifiedReturnType_es2017.ts(6,21): error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncQualifiedReturnType_es2017.ts (1 errors) ====
|
||||
namespace X {
|
||||
export class MyPromise<T> extends Promise<T> {
|
||||
}
|
||||
}
|
||||
|
||||
async function f(): X.MyPromise<void> {
|
||||
~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1064: The return type of an async function or method must be the global Promise<T> type.
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
//// [asyncQualifiedReturnType_es2017.ts]
|
||||
namespace X {
|
||||
export class MyPromise<T> extends Promise<T> {
|
||||
}
|
||||
}
|
||||
|
||||
async function f(): X.MyPromise<void> {
|
||||
}
|
||||
|
||||
//// [asyncQualifiedReturnType_es2017.js]
|
||||
var X;
|
||||
(function (X) {
|
||||
class MyPromise extends Promise {
|
||||
}
|
||||
X.MyPromise = MyPromise;
|
||||
})(X || (X = {}));
|
||||
async function f() {
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
tests/cases/conformance/async/es2017/asyncSetter_es2017.ts(2,3): error TS1042: 'async' modifier cannot be used here.
|
||||
|
||||
|
||||
==== tests/cases/conformance/async/es2017/asyncSetter_es2017.ts (1 errors) ====
|
||||
class C {
|
||||
async set foo(value) {
|
||||
~~~~~
|
||||
!!! error TS1042: 'async' modifier cannot be used here.
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
//// [asyncSetter_es2017.ts]
|
||||
class C {
|
||||
async set foo(value) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncSetter_es2017.js]
|
||||
class C {
|
||||
async set foo(value) {
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
//// [awaitUnion_es2017.ts]
|
||||
declare let a: number | string;
|
||||
declare let b: PromiseLike<number> | PromiseLike<string>;
|
||||
declare let c: PromiseLike<number | string>;
|
||||
declare let d: number | PromiseLike<string>;
|
||||
declare let e: number | PromiseLike<number | string>;
|
||||
async function f() {
|
||||
let await_a = await a;
|
||||
let await_b = await b;
|
||||
let await_c = await c;
|
||||
let await_d = await d;
|
||||
let await_e = await e;
|
||||
}
|
||||
|
||||
//// [awaitUnion_es2017.js]
|
||||
async function f() {
|
||||
let await_a = await a;
|
||||
let await_b = await b;
|
||||
let await_c = await c;
|
||||
let await_d = await d;
|
||||
let await_e = await e;
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
=== tests/cases/conformance/async/es2017/awaitUnion_es2017.ts ===
|
||||
declare let a: number | string;
|
||||
>a : Symbol(a, Decl(awaitUnion_es2017.ts, 0, 11))
|
||||
|
||||
declare let b: PromiseLike<number> | PromiseLike<string>;
|
||||
>b : Symbol(b, Decl(awaitUnion_es2017.ts, 1, 11))
|
||||
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
|
||||
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
declare let c: PromiseLike<number | string>;
|
||||
>c : Symbol(c, Decl(awaitUnion_es2017.ts, 2, 11))
|
||||
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
declare let d: number | PromiseLike<string>;
|
||||
>d : Symbol(d, Decl(awaitUnion_es2017.ts, 3, 11))
|
||||
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
declare let e: number | PromiseLike<number | string>;
|
||||
>e : Symbol(e, Decl(awaitUnion_es2017.ts, 4, 11))
|
||||
>PromiseLike : Symbol(PromiseLike, Decl(lib.es5.d.ts, --, --))
|
||||
|
||||
async function f() {
|
||||
>f : Symbol(f, Decl(awaitUnion_es2017.ts, 4, 53))
|
||||
|
||||
let await_a = await a;
|
||||
>await_a : Symbol(await_a, Decl(awaitUnion_es2017.ts, 6, 4))
|
||||
>a : Symbol(a, Decl(awaitUnion_es2017.ts, 0, 11))
|
||||
|
||||
let await_b = await b;
|
||||
>await_b : Symbol(await_b, Decl(awaitUnion_es2017.ts, 7, 4))
|
||||
>b : Symbol(b, Decl(awaitUnion_es2017.ts, 1, 11))
|
||||
|
||||
let await_c = await c;
|
||||
>await_c : Symbol(await_c, Decl(awaitUnion_es2017.ts, 8, 4))
|
||||
>c : Symbol(c, Decl(awaitUnion_es2017.ts, 2, 11))
|
||||
|
||||
let await_d = await d;
|
||||
>await_d : Symbol(await_d, Decl(awaitUnion_es2017.ts, 9, 4))
|
||||
>d : Symbol(d, Decl(awaitUnion_es2017.ts, 3, 11))
|
||||
|
||||
let await_e = await e;
|
||||
>await_e : Symbol(await_e, Decl(awaitUnion_es2017.ts, 10, 4))
|
||||
>e : Symbol(e, Decl(awaitUnion_es2017.ts, 4, 11))
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
=== tests/cases/conformance/async/es2017/awaitUnion_es2017.ts ===
|
||||
declare let a: number | string;
|
||||
>a : string | number
|
||||
|
||||
declare let b: PromiseLike<number> | PromiseLike<string>;
|
||||
>b : PromiseLike<number> | PromiseLike<string>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
declare let c: PromiseLike<number | string>;
|
||||
>c : PromiseLike<string | number>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
declare let d: number | PromiseLike<string>;
|
||||
>d : number | PromiseLike<string>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
declare let e: number | PromiseLike<number | string>;
|
||||
>e : number | PromiseLike<string | number>
|
||||
>PromiseLike : PromiseLike<T>
|
||||
|
||||
async function f() {
|
||||
>f : () => Promise<void>
|
||||
|
||||
let await_a = await a;
|
||||
>await_a : string | number
|
||||
>await a : string | number
|
||||
>a : string | number
|
||||
|
||||
let await_b = await b;
|
||||
>await_b : string | number
|
||||
>await b : string | number
|
||||
>b : PromiseLike<number> | PromiseLike<string>
|
||||
|
||||
let await_c = await c;
|
||||
>await_c : string | number
|
||||
>await c : string | number
|
||||
>c : PromiseLike<string | number>
|
||||
|
||||
let await_d = await d;
|
||||
>await_d : string | number
|
||||
>await d : string | number
|
||||
>d : number | PromiseLike<string>
|
||||
|
||||
let await_e = await e;
|
||||
>await_e : string | number
|
||||
>await e : string | number
|
||||
>e : number | PromiseLike<string | number>
|
||||
}
|
||||
@@ -8,7 +8,7 @@ async function asyncFunc() {
|
||||
await 0;
|
||||
}
|
||||
|
||||
const asycnArrowFunc = async (): Promise<void> => {
|
||||
const asyncArrowFunc = async (): Promise<void> => {
|
||||
await 0;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ async () => {
|
||||
async function asyncFunc() {
|
||||
await 0;
|
||||
}
|
||||
const asycnArrowFunc = async () => {
|
||||
const asyncArrowFunc = async () => {
|
||||
await 0;
|
||||
};
|
||||
async function asyncIIFE() {
|
||||
|
||||
@@ -12,8 +12,8 @@ async function asyncFunc() {
|
||||
await 0;
|
||||
}
|
||||
|
||||
const asycnArrowFunc = async (): Promise<void> => {
|
||||
>asycnArrowFunc : Symbol(asycnArrowFunc, Decl(es2017basicAsync.ts, 9, 5))
|
||||
const asyncArrowFunc = async (): Promise<void> => {
|
||||
>asyncArrowFunc : Symbol(asyncArrowFunc, Decl(es2017basicAsync.ts, 9, 5))
|
||||
>Promise : Symbol(Promise, Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --))
|
||||
|
||||
await 0;
|
||||
|
||||
@@ -17,8 +17,8 @@ async function asyncFunc() {
|
||||
>0 : 0
|
||||
}
|
||||
|
||||
const asycnArrowFunc = async (): Promise<void> => {
|
||||
>asycnArrowFunc : () => Promise<void>
|
||||
const asyncArrowFunc = async (): Promise<void> => {
|
||||
>asyncArrowFunc : () => Promise<void>
|
||||
>async (): Promise<void> => { await 0;} : () => Promise<void>
|
||||
>Promise : Promise<T>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ async function asyncFunc() {
|
||||
await 0;
|
||||
}
|
||||
|
||||
const asycnArrowFunc = async (): Promise<void> => {
|
||||
const asyncArrowFunc = async (): Promise<void> => {
|
||||
await 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
type PromiseAlias<T> = Promise<T>;
|
||||
|
||||
async function f(): PromiseAlias<void> {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
async class C {
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
class C {
|
||||
async constructor() {
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
declare async function foo(): Promise<void>;
|
||||
@@ -1,5 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
async enum E {
|
||||
Value
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
class C {
|
||||
async get foo() {
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// @target: es2017
|
||||
// @module: commonjs
|
||||
// @filename: task.ts
|
||||
export class Task<T> extends Promise<T> { }
|
||||
|
||||
// @filename: test.ts
|
||||
import { Task } from "./task";
|
||||
class Test {
|
||||
async example<T>(): Task<T> { return; }
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
async interface I {
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
async module M {
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
// @target: es2017
|
||||
// @filename: a.ts
|
||||
async function f() {}
|
||||
// @filename: b.ts
|
||||
function g() { }
|
||||
@@ -1,9 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
namespace X {
|
||||
export class MyPromise<T> extends Promise<T> {
|
||||
}
|
||||
}
|
||||
|
||||
async function f(): X.MyPromise<void> {
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
class C {
|
||||
async set foo(value) {
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
declare let a: number | string;
|
||||
declare let b: PromiseLike<number> | PromiseLike<string>;
|
||||
declare let c: PromiseLike<number | string>;
|
||||
declare let d: number | PromiseLike<string>;
|
||||
declare let e: number | PromiseLike<number | string>;
|
||||
async function f() {
|
||||
let await_a = await a;
|
||||
let await_b = await b;
|
||||
let await_c = await c;
|
||||
let await_d = await d;
|
||||
let await_e = await e;
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
// @target: es2017
|
||||
// @noEmitHelpers: true
|
||||
declare class Thenable { then(): void; }
|
||||
declare let a: any;
|
||||
declare let obj: { then: string; };
|
||||
declare let thenable: Thenable;
|
||||
async function fn1() { } // valid: Promise<void>
|
||||
async function fn2(): { } { } // error
|
||||
async function fn3(): any { } // error
|
||||
async function fn4(): number { } // error
|
||||
async function fn5(): PromiseLike<void> { } // error
|
||||
async function fn6(): Thenable { } // error
|
||||
async function fn7() { return; } // valid: Promise<void>
|
||||
async function fn8() { return 1; } // valid: Promise<number>
|
||||
async function fn9() { return null; } // valid: Promise<any>
|
||||
async function fn10() { return undefined; } // valid: Promise<any>
|
||||
async function fn11() { return a; } // valid: Promise<any>
|
||||
async function fn12() { return obj; } // valid: Promise<{ then: string; }>
|
||||
async function fn13() { return thenable; } // error
|
||||
async function fn14() { await 1; } // valid: Promise<void>
|
||||
async function fn15() { await null; } // valid: Promise<void>
|
||||
async function fn16() { await undefined; } // valid: Promise<void>
|
||||
async function fn17() { await a; } // valid: Promise<void>
|
||||
async function fn18() { await obj; } // valid: Promise<void>
|
||||
async function fn19() { await thenable; } // error
|
||||
Reference in New Issue
Block a user