TypeScript/tests/cases/fourslash/importNameCodeFix_endingPreference.ts
Andy b94061c587
getEditsForFileRename: Avoid changing import specifier ending (#26177)
* getEditsForFileRename: Avoid changing import specifier ending

* Support .json and .jsx extensions

* Restore typeRoots tests

* Fix json test

* When --jsx preserve is set, import ".tsx" file with ".jsx" extension

* Support ending preference in UserPreferences
2018-08-28 13:03:24 -07:00

27 lines
686 B
TypeScript

/// <reference path="fourslash.ts" />
// @moduleResolution: node
// @Filename: /foo/index.ts
////export const foo = 0;
// @Filename: /a.ts
////foo;
// @Filename: /b.ts
////foo;
// @Filename: /c.ts
////foo;
const tests: ReadonlyArray<[string, FourSlashInterface.UserPreferences["importModuleSpecifierEnding"], string]> = [
["/a.ts", "js", "./foo/index.js"],
["/b.ts", "index", "./foo/index"],
["/c.ts", "minimal", "./foo"],
];
for (const [fileName, importModuleSpecifierEnding, specifier] of tests) {
goTo.file(fileName);
verify.importFixAtPosition([`import { foo } from "${specifier}";\n\nfoo;`,], /*errorCode*/ undefined, { importModuleSpecifierEnding });
}