fix(41244): ignore synthesized imports (#41267)

This commit is contained in:
Oleksandr T
2020-10-27 22:22:02 +02:00
committed by GitHub
parent c923023494
commit 9ed608b439
3 changed files with 35 additions and 1 deletions

View File

@@ -1827,7 +1827,9 @@ namespace ts {
return preferences.quotePreference === "single" ? QuotePreference.Single : QuotePreference.Double;
}
else {
const firstModuleSpecifier = sourceFile.imports && find(sourceFile.imports, isStringLiteral);
// ignore synthetic import added when importHelpers: true
const firstModuleSpecifier = sourceFile.imports &&
find(sourceFile.imports, n => isStringLiteral(n) && !nodeIsSynthesized(n.parent)) as StringLiteral;
return firstModuleSpecifier ? quotePreferenceFromString(firstModuleSpecifier, sourceFile) : QuotePreference.Double;
}
}