File tree 2 files changed +5
-1
lines changed
testRunner/unittests/services
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,9 @@ namespace ts.OrganizeImports {
237
237
? createNamedImports ( sortedImportSpecifiers )
238
238
: updateNamedImports ( namedImports [ 0 ] . importClause ! . namedBindings as NamedImports , sortedImportSpecifiers ) ; // TODO: GH#18217
239
239
240
- // Type-only imports are not allowed to combine
240
+ // Type-only imports are not allowed to mix default, namespace, and named imports in any combination.
241
+ // We could rewrite a default import as a named import (`import { default as name }`), but we currently
242
+ // choose not to as a stylistic preference.
241
243
if ( isTypeOnly && newDefaultImport && newNamedImports ) {
242
244
coalescedImports . push (
243
245
updateImportDeclarationAndClause ( importDecl , newDefaultImport , /*namedBindings*/ undefined ) ) ;
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ namespace ts {
186
186
`import type { x } from "lib";` ,
187
187
`import type * as y from "lib";` ,
188
188
`import type z from "lib";` ) ;
189
+ // Default import could be rewritten as a named import to combine with `x`,
190
+ // but seems of debatable merit.
189
191
const actualCoalescedImports = OrganizeImports . coalesceImports ( sortedImports ) ;
190
192
const expectedCoalescedImports = actualCoalescedImports ;
191
193
assertListEqual ( actualCoalescedImports , expectedCoalescedImports ) ;
You can’t perform that action at this time.
0 commit comments