mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
fix(60505): Convert to namespace import refactoring should drop file extensions on namespace name (#60510)
This commit is contained in:
parent
b3c67d3202
commit
d6b7c41fbc
@ -4061,7 +4061,7 @@ export function moduleSymbolToValidIdentifier(moduleSymbol: Symbol, target: Scri
|
||||
|
||||
/** @internal */
|
||||
export function moduleSpecifierToValidIdentifier(moduleSpecifier: string, target: ScriptTarget | undefined, forceCapitalize?: boolean): string {
|
||||
const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
|
||||
const baseName = getBaseFileName(removeSuffix(removeFileExtension(moduleSpecifier), "/index"));
|
||||
let res = "";
|
||||
let lastCharWasValid = true;
|
||||
const firstCharCode = baseName.charCodeAt(0);
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
|
||||
// @filename: /a.js
|
||||
/////*a*/import { a } from "./foo.js";/*b*/
|
||||
////a;
|
||||
|
||||
goTo.select("a", "b");
|
||||
edit.applyRefactor({
|
||||
refactorName: "Convert import",
|
||||
actionName: "Convert named imports to namespace import",
|
||||
actionDescription: "Convert named imports to namespace import",
|
||||
newContent:
|
||||
`import * as foo from "./foo.js";
|
||||
foo.a;`,
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user