mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 11:46:08 -05:00
suppress type annotations in js file
This commit is contained in:
@@ -70,7 +70,7 @@ namespace ts.codefix {
|
||||
function getActionsForAddMissingMemberInJavaScriptFile(classDeclaration: ClassLikeDeclaration, makeStatic: boolean): CodeAction[] | undefined {
|
||||
let actions: CodeAction[];
|
||||
|
||||
const methodCodeAction = getActionForMethodDeclaration();
|
||||
const methodCodeAction = getActionForMethodDeclaration(/*includeTypeScriptSyntax*/ false);
|
||||
if (methodCodeAction) {
|
||||
actions = [methodCodeAction];
|
||||
}
|
||||
@@ -130,7 +130,7 @@ namespace ts.codefix {
|
||||
function getActionsForAddMissingMemberInTypeScriptFile(classDeclaration: ClassLikeDeclaration, makeStatic: boolean): CodeAction[] | undefined {
|
||||
let actions: CodeAction[];
|
||||
|
||||
const methodCodeAction = getActionForMethodDeclaration();
|
||||
const methodCodeAction = getActionForMethodDeclaration(/*includeTypeScriptSyntax*/ true);
|
||||
if (methodCodeAction) {
|
||||
actions = [methodCodeAction];
|
||||
}
|
||||
@@ -189,10 +189,10 @@ namespace ts.codefix {
|
||||
return actions;
|
||||
}
|
||||
|
||||
function getActionForMethodDeclaration(): CodeAction | undefined {
|
||||
function getActionForMethodDeclaration(includeTypeScriptSyntax: boolean): CodeAction | undefined {
|
||||
if (token.parent.parent.kind === SyntaxKind.CallExpression) {
|
||||
const callExpression = <CallExpression>token.parent.parent;
|
||||
const methodDeclaration = createMethodFromCallExpression(callExpression, tokenName, /*includeTypeScriptSyntax*/ true, makeStatic);
|
||||
const methodDeclaration = createMethodFromCallExpression(callExpression, tokenName, includeTypeScriptSyntax, makeStatic);
|
||||
|
||||
const methodDeclarationChangeTracker = textChanges.ChangeTracker.fromCodeFixContext(context);
|
||||
methodDeclarationChangeTracker.insertNodeAfter(classDeclarationSourceFile, classOpenBrace, methodDeclaration, { suffix: context.newLineCharacter });
|
||||
|
||||
Reference in New Issue
Block a user