mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-08 08:14:51 -06:00
Fix misplaced comma in auto imported specifier (#40273)
This commit is contained in:
parent
97f8b87e34
commit
bfb00eb164
@ -700,7 +700,7 @@ namespace ts.codefix {
|
||||
}
|
||||
else if (existingSpecifiers?.length) {
|
||||
for (const spec of newSpecifiers) {
|
||||
changes.insertNodeAtEndOfList(sourceFile, existingSpecifiers, spec);
|
||||
changes.insertNodeInListAfter(sourceFile, last(existingSpecifiers), spec, existingSpecifiers);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
24
tests/cases/fourslash/importNameCodeFix_trailingComma.ts
Normal file
24
tests/cases/fourslash/importNameCodeFix_trailingComma.ts
Normal file
@ -0,0 +1,24 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// Bug #40219 only happens when existing import specifiers are unsorted.
|
||||
|
||||
// @Filename: index.ts
|
||||
//// import {
|
||||
//// T2,
|
||||
//// T1,
|
||||
//// } from "./types";
|
||||
////
|
||||
//// const x: T3/**/
|
||||
|
||||
// @Filename: types.ts
|
||||
//// export type T1 = 0;
|
||||
//// export type T2 = 0;
|
||||
//// export type T3 = 0;
|
||||
|
||||
verify.importFixAtPosition([`import {
|
||||
T2,
|
||||
T1,
|
||||
T3,
|
||||
} from "./types";
|
||||
|
||||
const x: T3`]);
|
||||
Loading…
x
Reference in New Issue
Block a user