TypeScript/tests/cases/fourslash/codeFixConvertToTypeOnlyExport1.ts
Michael 71cd5d522d
Fix two issues with ConvertToTypeOnlyExport codefix (#40490)
* Modify test case to reproduce error

* Fix TypeOnlyExport codefix to work with 3 or more type exports in the same declaration

The check to ensure that a fixed export declaration wasn't fixed again
was reversed. This only surfaced when 3 or more type exports existed in
the same declaration.

* Add failing test cases for comments being duplicated

* Fix convertToTypeOnlyExport codefix from duplicating leading comments

* Simplify convertToTypeOnlyExport when change is just inserting `type` keyword

Co-authored-by: Andrew Branch <andrew@wheream.io>
2020-10-27 15:08:20 -07:00

22 lines
516 B
TypeScript

/// <reference path="fourslash.ts" />
// @isolatedModules: true
// @Filename: /a.ts
////export type A = {};
////export type B = {};
// @Filename: /b.ts
/////* Comment */
////export { A, B } from './a';
goTo.file("/b.ts");
verify.codeFix({
index: 0,
description: ts.Diagnostics.Convert_to_type_only_export.message,
errorCode: ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type.code,
newFileContent:
`/* Comment */
export type { A, B } from './a';`
});