1//@target: ES6 2interface T1 { 3 __t1: string; 4} 5 6interface T2 { 7 __t2: string; 8} 9 10interface T3 { 11 __t3: string; 12} 13 14function f1(): Promise<T1> { 15 return Promise.resolve({ __t1: "foo_t1" }); 16} 17 18function f2(x: T1): T2 { 19 return { __t2: x.__t1 + ":foo_21" }; 20} 21 22var x3 = f1() 23 .then(f2, (e: Error) => { 24 throw e; 25}) 26 .then((x: T2) => { 27 return { __t3: x.__t2 + "bar" }; 28});