|
| 1 | +=== tests/cases/compiler/file1.ts === |
| 2 | +"use strict"; |
| 3 | +>"use strict" : string |
| 4 | + |
| 5 | +import * as MyModule from "./mymodule"; |
| 6 | +>MyModule : typeof MyModule |
| 7 | + |
| 8 | +export class BrokenClass { |
| 9 | +>BrokenClass : BrokenClass |
| 10 | + |
| 11 | + constructor() {} |
| 12 | + |
| 13 | + public brokenMethod(field: string, value: string) { |
| 14 | +>brokenMethod : (field: string, value: string) => Promise<MyModule.MyModel[]> |
| 15 | +>field : string |
| 16 | +>value : string |
| 17 | + |
| 18 | + return new Promise<Array<MyModule.MyModel>>((resolve, reject) => { |
| 19 | +>new Promise<Array<MyModule.MyModel>>((resolve, reject) => { let result: Array<MyModule.MyModel> = []; let populateItems = (order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); }; return Promise.all(result.map(populateItems)) .then((orders: Array<MyModule.MyModel>) => { resolve(orders); }); }) : Promise<MyModule.MyModel[]> |
| 20 | +>Promise : PromiseConstructor |
| 21 | +>Array : T[] |
| 22 | +>MyModule : any |
| 23 | +>MyModel : MyModule.MyModel |
| 24 | +>(resolve, reject) => { let result: Array<MyModule.MyModel> = []; let populateItems = (order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); }; return Promise.all(result.map(populateItems)) .then((orders: Array<MyModule.MyModel>) => { resolve(orders); }); } : (resolve: (value?: MyModule.MyModel[] | PromiseLike<MyModule.MyModel[]>) => void, reject: (reason?: any) => void) => Promise<void> |
| 25 | +>resolve : (value?: MyModule.MyModel[] | PromiseLike<MyModule.MyModel[]>) => void |
| 26 | +>reject : (reason?: any) => void |
| 27 | + |
| 28 | + let result: Array<MyModule.MyModel> = []; |
| 29 | +>result : MyModule.MyModel[] |
| 30 | +>Array : T[] |
| 31 | +>MyModule : any |
| 32 | +>MyModel : MyModule.MyModel |
| 33 | +>[] : undefined[] |
| 34 | + |
| 35 | + let populateItems = (order) => { |
| 36 | +>populateItems : (order: any) => Promise<{}> |
| 37 | +>(order) => { return new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }); } : (order: any) => Promise<{}> |
| 38 | +>order : any |
| 39 | + |
| 40 | + return new Promise((resolve, reject) => { |
| 41 | +>new Promise((resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); }) : Promise<{}> |
| 42 | +>Promise : PromiseConstructor |
| 43 | +>(resolve, reject) => { this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }); } : (resolve: (value?: {} | PromiseLike<{}>) => void, reject: (reason?: any) => void) => void |
| 44 | +>resolve : (value?: {} | PromiseLike<{}>) => void |
| 45 | +>reject : (reason?: any) => void |
| 46 | + |
| 47 | + this.doStuff(order.id) |
| 48 | +>this.doStuff(order.id) .then((items) => { order.items = items; resolve(order); }) : Promise<void> |
| 49 | +>this.doStuff(order.id) .then : { <TResult>(onfulfilled?: (value: void) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: void) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; } |
| 50 | +>this.doStuff(order.id) : Promise<void> |
| 51 | +>this.doStuff : (id: number) => Promise<void> |
| 52 | +>this : this |
| 53 | +>doStuff : (id: number) => Promise<void> |
| 54 | +>order.id : any |
| 55 | +>order : any |
| 56 | +>id : any |
| 57 | + |
| 58 | + .then((items) => { |
| 59 | +>then : { <TResult>(onfulfilled?: (value: void) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: void) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; } |
| 60 | +>(items) => { order.items = items; resolve(order); } : (items: void) => void |
| 61 | +>items : void |
| 62 | + |
| 63 | + order.items = items; |
| 64 | +>order.items = items : void |
| 65 | +>order.items : any |
| 66 | +>order : any |
| 67 | +>items : any |
| 68 | +>items : void |
| 69 | + |
| 70 | + resolve(order); |
| 71 | +>resolve(order) : void |
| 72 | +>resolve : (value?: {} | PromiseLike<{}>) => void |
| 73 | +>order : any |
| 74 | + |
| 75 | + }); |
| 76 | + }); |
| 77 | + }; |
| 78 | + |
| 79 | + return Promise.all(result.map(populateItems)) |
| 80 | +>Promise.all(result.map(populateItems)) .then((orders: Array<MyModule.MyModel>) => { resolve(orders); }) : Promise<void> |
| 81 | +>Promise.all(result.map(populateItems)) .then : { <TResult>(onfulfilled?: (value: {}[]) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: {}[]) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; } |
| 82 | +>Promise.all(result.map(populateItems)) : Promise<{}[]> |
| 83 | +>Promise.all : { <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; <T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; <T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; <T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>; <T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>; <T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>; <T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>; <T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>; <TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>; } |
| 84 | +>Promise : PromiseConstructor |
| 85 | +>all : { <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; <T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; <T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>; <T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>; <T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>; <T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>; <T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<[T1, T2, T3, T4]>; <T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>; <T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>; <TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>; } |
| 86 | +>result.map(populateItems) : Promise<{}>[] |
| 87 | +>result.map : <U>(callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] |
| 88 | +>result : MyModule.MyModel[] |
| 89 | +>map : <U>(callbackfn: (value: MyModule.MyModel, index: number, array: MyModule.MyModel[]) => U, thisArg?: any) => U[] |
| 90 | +>populateItems : (order: any) => Promise<{}> |
| 91 | + |
| 92 | + .then((orders: Array<MyModule.MyModel>) => { |
| 93 | +>then : { <TResult>(onfulfilled?: (value: {}[]) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>; <TResult>(onfulfilled?: (value: {}[]) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; } |
| 94 | +>(orders: Array<MyModule.MyModel>) => { resolve(orders); } : (orders: MyModule.MyModel[]) => void |
| 95 | +>orders : MyModule.MyModel[] |
| 96 | +>Array : T[] |
| 97 | +>MyModule : any |
| 98 | +>MyModel : MyModule.MyModel |
| 99 | + |
| 100 | + resolve(orders); |
| 101 | +>resolve(orders) : void |
| 102 | +>resolve : (value?: MyModule.MyModel[] | PromiseLike<MyModule.MyModel[]>) => void |
| 103 | +>orders : MyModule.MyModel[] |
| 104 | + |
| 105 | + }); |
| 106 | + }); |
| 107 | + } |
| 108 | + |
| 109 | + public async doStuff(id: number) { |
| 110 | +>doStuff : (id: number) => Promise<void> |
| 111 | +>id : number |
| 112 | + |
| 113 | + return; |
| 114 | + } |
| 115 | +} |
| 116 | + |
| 117 | +=== tests/cases/compiler/mymodule.ts === |
| 118 | +export interface MyModel { |
| 119 | +>MyModel : MyModel |
| 120 | + |
| 121 | + id: number; |
| 122 | +>id : number |
| 123 | +} |
0 commit comments