forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpromiseTry.types
More file actions
39 lines (32 loc) · 1.45 KB
/
promiseTry.types
File metadata and controls
39 lines (32 loc) · 1.45 KB
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
//// [tests/cases/compiler/promiseTry.ts] ////
=== promiseTry.ts ===
Promise.try(() => {
>Promise.try(() => { return "Sync result";}) : Promise<string>
> : ^^^^^^^^^^^^^^^
>Promise.try : <T>(callbackFn: () => T | Promise<T>) => Promise<T>
> : ^ ^^ ^^ ^^^^^
>Promise : PromiseConstructor
> : ^^^^^^^^^^^^^^^^^^
>try : <T>(callbackFn: () => T | Promise<T>) => Promise<T>
> : ^ ^^ ^^ ^^^^^
>() => { return "Sync result";} : () => string
> : ^^^^^^^^^^^^
return "Sync result";
>"Sync result" : "Sync result"
> : ^^^^^^^^^^^^^
});
Promise.try(async () => {
>Promise.try(async () => { return "Async result";}) : Promise<string>
> : ^^^^^^^^^^^^^^^
>Promise.try : <T>(callbackFn: () => T | Promise<T>) => Promise<T>
> : ^ ^^ ^^ ^^^^^
>Promise : PromiseConstructor
> : ^^^^^^^^^^^^^^^^^^
>try : <T>(callbackFn: () => T | Promise<T>) => Promise<T>
> : ^ ^^ ^^ ^^^^^
>async () => { return "Async result";} : () => Promise<string>
> : ^^^^^^^^^^^^^^^^^^^^^
return "Async result";
>"Async result" : "Async result"
> : ^^^^^^^^^^^^^^
});