File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
testRunner/unittests/services Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -237,7 +237,9 @@ namespace ts.OrganizeImports {
237237 ? createNamedImports ( sortedImportSpecifiers )
238238 : updateNamedImports ( namedImports [ 0 ] . importClause ! . namedBindings as NamedImports , sortedImportSpecifiers ) ; // TODO: GH#18217
239239
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.
241243 if ( isTypeOnly && newDefaultImport && newNamedImports ) {
242244 coalescedImports . push (
243245 updateImportDeclarationAndClause ( importDecl , newDefaultImport , /*namedBindings*/ undefined ) ) ;
Original file line number Diff line number Diff line change @@ -186,6 +186,8 @@ namespace ts {
186186 `import type { x } from "lib";` ,
187187 `import type * as y from "lib";` ,
188188 `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.
189191 const actualCoalescedImports = OrganizeImports . coalesceImports ( sortedImports ) ;
190192 const expectedCoalescedImports = actualCoalescedImports ;
191193 assertListEqual ( actualCoalescedImports , expectedCoalescedImports ) ;
You can’t perform that action at this time.
0 commit comments