TypeScript/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_decoratedMethod.ts

25 lines
499 B
TypeScript

// ==ORIGINAL==
function decorator() {
return (target: any, key: any, descriptor: PropertyDescriptor) => descriptor;
}
class Foo {
@decorator()
/*[#|*/method/*|]*/() {
return fetch('a').then(x => x);
}
}
// ==ASYNC FUNCTION::Convert to async function==
function decorator() {
return (target: any, key: any, descriptor: PropertyDescriptor) => descriptor;
}
class Foo {
@decorator()
async method() {
const x = await fetch('a');
return x;
}
}