You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/a.js(21,14): error TS1055: Type 'string' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
2
+
/a.js(27,12): error TS1065: The return type of an async function or method must be the global Promise<T> type.
3
+
/a.js(45,12): error TS1065: The return type of an async function or method must be the global Promise<T> type.
4
+
Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
5
+
Construct signature return types 'Thenable' and 'PromiseLike<T>' are incompatible.
6
+
The types returned by 'then(...)' are incompatible between these types.
7
+
Type 'void' is not assignable to type 'PromiseLike<TResult1 | TResult2>'.
8
+
9
+
10
+
==== /types.d.ts (0 errors) ====
11
+
declare class Thenable { then(): void; }
12
+
13
+
==== /a.js (3 errors) ====
14
+
/**
15
+
* @callback T1
16
+
* @param {string} str
17
+
* @returns {string}
18
+
*/
19
+
20
+
/**
21
+
* @callback T2
22
+
* @param {string} str
23
+
* @returns {Promise<string>}
24
+
*/
25
+
26
+
/**
27
+
* @callback T3
28
+
* @param {string} str
29
+
* @returns {Thenable}
30
+
*/
31
+
32
+
/**
33
+
* @param {string} str
34
+
* @returns {string}
35
+
~~~~~~
36
+
!!! error TS1055: Type 'string' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
37
+
*/
38
+
const f1 = async str => {
39
+
return str;
40
+
}
41
+
42
+
/** @type {T1} */
43
+
~~
44
+
!!! error TS1065: The return type of an async function or method must be the global Promise<T> type.
45
+
!!! related TS1055 /a.js:4:14: Type 'string' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
46
+
const f2 = async str => {
47
+
return str;
48
+
}
49
+
50
+
/**
51
+
* @param {string} str
52
+
* @returns {Promise<string>}
53
+
*/
54
+
const f3 = async str => {
55
+
return str;
56
+
}
57
+
58
+
/** @type {T2} */
59
+
const f4 = async str => {
60
+
return str;
61
+
}
62
+
63
+
/** @type {T3} */
64
+
~~
65
+
!!! error TS1065: The return type of an async function or method must be the global Promise<T> type.
66
+
!!! error TS1065: Type 'typeof Thenable' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value.
67
+
!!! error TS1065: Construct signature return types 'Thenable' and 'PromiseLike<T>' are incompatible.
68
+
!!! error TS1065: The types returned by 'then(...)' are incompatible between these types.
69
+
!!! error TS1065: Type 'void' is not assignable to type 'PromiseLike<TResult1 | TResult2>'.
0 commit comments