2019-07-12 20:03:20 +02:00
|
|
|
/// <reference path="fourslash.ts" />
|
|
|
|
////declare class C { foo(): void }
|
2019-07-16 00:17:32 +02:00
|
|
|
////declare function getC(): { Class: C };
|
2019-07-12 20:03:20 +02:00
|
|
|
////declare function foo(): string;
|
|
|
|
////async function f() {
|
|
|
|
//// await "";
|
|
|
|
//// await 0;
|
|
|
|
//// (await foo()).toLowerCase();
|
|
|
|
//// (await 0).toFixed();
|
|
|
|
//// (await new C).foo();
|
2019-07-16 00:17:32 +02:00
|
|
|
//// (await function() { }());
|
|
|
|
//// new (await getC()).Class();
|
2019-07-12 20:03:20 +02:00
|
|
|
////}
|
|
|
|
|
|
|
|
verify.codeFix({
|
|
|
|
description: ts.Diagnostics.Remove_unnecessary_await.message,
|
|
|
|
index: 0,
|
|
|
|
newFileContent:
|
|
|
|
`declare class C { foo(): void }
|
2019-07-16 00:17:32 +02:00
|
|
|
declare function getC(): { Class: C };
|
2019-07-12 20:03:20 +02:00
|
|
|
declare function foo(): string;
|
|
|
|
async function f() {
|
|
|
|
"";
|
|
|
|
await 0;
|
|
|
|
(await foo()).toLowerCase();
|
|
|
|
(await 0).toFixed();
|
|
|
|
(await new C).foo();
|
2019-07-16 00:17:32 +02:00
|
|
|
(await function() { }());
|
|
|
|
new (await getC()).Class();
|
2019-07-12 20:03:20 +02:00
|
|
|
}`
|
|
|
|
});
|
|
|
|
|
|
|
|
verify.codeFixAll({
|
|
|
|
fixAllDescription: ts.Diagnostics.Remove_all_unnecessary_uses_of_await.message,
|
|
|
|
fixId: "removeUnnecessaryAwait",
|
|
|
|
newFileContent:
|
|
|
|
`declare class C { foo(): void }
|
2019-07-16 00:17:32 +02:00
|
|
|
declare function getC(): { Class: C };
|
2019-07-12 20:03:20 +02:00
|
|
|
declare function foo(): string;
|
|
|
|
async function f() {
|
|
|
|
"";
|
|
|
|
0;
|
|
|
|
foo().toLowerCase();
|
|
|
|
(0).toFixed();
|
|
|
|
(new C).foo();
|
2019-07-16 00:17:32 +02:00
|
|
|
(function() { } ());
|
|
|
|
new (getC()).Class();
|
2019-07-12 20:03:20 +02:00
|
|
|
}`
|
|
|
|
});
|