TypeScript/tests/cases/fourslash/convertFunctionToEs6Class_asyncMethods.ts
Andrew Branch 89badcc9d5
Add 'Remove unnecessary await' suggestion and fix (#32363)
* Add remove unnecessary await fix

* Add test for removing unnecessary parens after await is gone

* Fix handling of numbers in property access expressions

* Don’t offer suggestion when awaited type is any/unknown

* Fix random other test

* Fix new expression edge cases

* Only remove parens for identifiers and call expressions
2019-07-12 11:03:20 -07:00

30 lines
615 B
TypeScript

/// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: test123.js
// @lib: es5
////export function /**/MyClass() {
////}
////MyClass.prototype.foo = async function() {
//// await Promise.resolve();
////}
////MyClass.bar = async function() {
//// await Promise.resolve();
////}
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`export class MyClass {
constructor() {
}
async foo() {
await Promise.resolve();
}
static async bar() {
await Promise.resolve();
}
}
`,
});