-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(55237): TypeScript 5.2 "move to file" results in duplicate imports (
- Loading branch information
1 parent
f0374ce
commit bf78d17
Showing
5 changed files
with
155 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /common.ts | ||
////export const x = 1; | ||
|
||
// @filename: /a.ts | ||
////import { x } from "./common"; | ||
////[|export const bar = x;|] | ||
|
||
// @filename: /b.ts | ||
////import { x } from "./common"; | ||
////export const foo = x; | ||
|
||
verify.moveToFile({ | ||
newFileContents: { | ||
"/a.ts": "", | ||
"/b.ts": | ||
`import { x } from "./common"; | ||
export const foo = x; | ||
export const bar = x; | ||
`, | ||
}, | ||
interactiveRefactorArguments: { targetFile: "/b.ts" }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @filename: /common.ts | ||
////export const x = 1; | ||
|
||
// @filename: /a.ts | ||
////import { x } from "./common"; | ||
////export const a = x; | ||
////[|export const b = x;|] | ||
|
||
// @filename: /b.ts | ||
////import { x } from "./common"; | ||
////export const a = x; | ||
|
||
verify.moveToFile({ | ||
newFileContents: { | ||
"/a.ts": | ||
`import { x } from "./common"; | ||
export const a = x; | ||
`, | ||
"/b.ts": | ||
`import { x } from "./common"; | ||
export const a = x; | ||
export const b = x; | ||
`, | ||
}, | ||
interactiveRefactorArguments: { targetFile: "/b.ts" }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @allowJs: true | ||
// @module: commonjs | ||
// @filename: /common.js | ||
////export const x = 1; | ||
|
||
// @filename: /a.js | ||
////const { x } = require("./common"); | ||
////[|module.exports.b = x;|] | ||
|
||
// @filename: /b.js | ||
////const { x } = require("./common"); | ||
////module.exports.a = x; | ||
|
||
verify.moveToFile({ | ||
newFileContents: { | ||
"/a.js": "", | ||
"/b.js": | ||
`const { x } = require("./common"); | ||
module.exports.a = x; | ||
module.exports.b = x; | ||
`, | ||
}, | ||
interactiveRefactorArguments: { targetFile: "/b.js" }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// <reference path='fourslash.ts' /> | ||
|
||
// @allowJs: true | ||
// @module: commonjs | ||
// @filename: /common.js | ||
////export const x = 1; | ||
|
||
// @filename: /a.js | ||
////const { x } = require("./common"); | ||
////module.exports.a = x; | ||
////[|module.exports.b = x;|] | ||
|
||
// @filename: /b.js | ||
////const { x } = require("./common"); | ||
////module.exports.a = x; | ||
|
||
verify.moveToFile({ | ||
newFileContents: { | ||
"/a.js": | ||
`const { x } = require("./common"); | ||
module.exports.a = x; | ||
`, | ||
"/b.js": | ||
`const { x } = require("./common"); | ||
module.exports.a = x; | ||
module.exports.b = x; | ||
`, | ||
}, | ||
interactiveRefactorArguments: { targetFile: "/b.js" }, | ||
}); |