Skip to content

simply quick fix for import type missing typeof #24236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2018

Conversation

Kingwl
Copy link
Contributor

@Kingwl Kingwl commented May 18, 2018

Fixes #24172 #24192

@Kingwl
Copy link
Contributor Author

Kingwl commented May 18, 2018

@mhegazy
sorry about this,
i have do these change and i forget to commit it

return [createCodeFixAction(fixId, changes, Diagnostics.Add_missing_typeof, fixId, Diagnostics.Add_missing_typeof)];
},
fixIds: [fixId],
getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) =>
doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start!))),
});

function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode | undefined {
function getImportTypeNode(sourceFile: SourceFile, pos: number): ImportTypeNode {
const token = getTokenAtPosition(sourceFile, pos, /*includeJsDocComment*/ false);
Debug.assert(token.kind === SyntaxKind.ImportKeyword);
Debug.assert(token.parent.kind === SyntaxKind.ImportType);
return <ImportTypeNode>token.parent;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be cast(token.parent, isImportTypeNode).

@mhegazy mhegazy merged commit d60866a into microsoft:master May 18, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants