mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-23 18:48:40 -05:00
Fix await code action crashes when await is not in a function (#22623)
Fixes #22614
This commit is contained in:
committed by
Mohamed Hegazy
parent
9ff67f636b
commit
dc4001f41d
@@ -36,6 +36,10 @@ namespace ts.codefix {
|
||||
function getNodes(sourceFile: SourceFile, start: number): { insertBefore: Node, returnType: TypeNode | undefined } | undefined {
|
||||
const token = getTokenAtPosition(sourceFile, start, /*includeJsDocComment*/ false);
|
||||
const containingFunction = getContainingFunction(token);
|
||||
if (!containingFunction) {
|
||||
return;
|
||||
}
|
||||
|
||||
let insertBefore: Node | undefined;
|
||||
switch (containingFunction.kind) {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
|
||||
Reference in New Issue
Block a user