Skip to content

Commit ebe3123

Browse files
committed
insert import at the beginning of the file
1 parent 147de76 commit ebe3123

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/services/codefixes/importFixes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ namespace ts.codefix {
403403
: createImportClause(/*name*/ undefined, createNamedImports([createImportSpecifier(/*propertyName*/ undefined, createIdentifier(name))]));
404404
const importDecl = createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, importClause, createLiteral(moduleSpecifierWithoutQuotes));
405405
if (!lastImportDeclaration) {
406-
changeTracker.insertNodeAt(sourceFile, 0, importDecl, { suffix: `${context.newLineCharacter}${context.newLineCharacter}` });
406+
changeTracker.insertNodeAt(sourceFile, sourceFile.getStart(), importDecl, { suffix: `${context.newLineCharacter}${context.newLineCharacter}` });
407407
}
408408
else {
409409
changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl, { suffix: context.newLineCharacter });

0 commit comments

Comments
 (0)