TypeScript/tests/cases/fourslash/refactorConvertExport_namedToDefault.ts
Andy 806a661be3
Add refactor to convert named to default export and back (#24878)
* Add refactor to convert named to default export and back

* Support ambient module

* Handle declaration kinds that can't be default-exported

* Update API (#24966)
2018-06-25 10:34:24 -07:00

40 lines
889 B
TypeScript

/// <reference path='fourslash.ts' />
// @Filename: /a.ts
/////*a*/export function f() {}/*b*/
// @Filename: /b.ts
////import { f } from "./a";
////import { f as g } from "./a";
////import { f, other } from "./a";
////
////export { f } from "./a";
////export { f as i } from "./a";
////export { f as default } from "./a";
////
////import * as a from "./a";
////a.f();
goTo.select("a", "b");
edit.applyRefactor({
refactorName: "Convert export",
actionName: "Convert named export to default export",
actionDescription: "Convert named export to default export",
newContent: {
"/a.ts":
`export default function f() {}`,
"/b.ts":
`import f from "./a";
import g from "./a";
import f, { other } from "./a";
export { default as f } from "./a";
export { default as i } from "./a";
export { default } from "./a";
import * as a from "./a";
a.default();`,
},
});