mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
fix(36416): empty import path causes server crash (#36751)
This commit is contained in:
1 parent
bf370659b3
commit
e435054b3b
7 files changed
+160
-1
No files matched your search
@@ -1238,9 +1238,10 @@ namespace ts.textChanges {
|
||||
}
|
||||
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
const isFirstImport = sourceFile.imports.length && node === first(sourceFile.imports).parent || node === find(sourceFile.statements, isImportDeclaration);
|
||||
deleteNode(changes, sourceFile, node,
|
||||
// For first import, leave header comment in place
|
||||
node === sourceFile.imports[0].parent ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined);
|
||||
isFirstImport ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined);
|
||||
break;
|
||||
|
||||
case SyntaxKind.BindingElement:
|
||||
|
||||
Reference in new issue
Block a user