Skip to content

Commit 324663a

Browse files
fix(correct-ts-specifiers): subpath imports erroneously report ambiguity (#75)
1 parent 0a9e895 commit 324663a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

recipes/correct-ts-specifiers/src/map-imports.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('Map Imports', { concurrency: true }, () => {
6969
const specifier = './fixtures/bar.js';
7070
const output = await mapImports(originatingFilePath, specifier);
7171

72-
assert.equal(output.replacement, specifier);
72+
assert.equal(output.replacement, undefined);
7373
assert.notEqual(output.isType, true);
7474
});
7575

recipes/correct-ts-specifiers/src/replace-js-ext-with-ts-ext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ async function checkSet<Ext extends DExt | JSExt | TSExt>(
9595

9696
const found = new Set<Specifier>();
9797
for (const ext of exts) {
98+
if (ext === oExt) continue;
9899
const potential = composeReplacement(specifier, oExt, ext);
99100
if (await fexists(parentPath, potential)) found.add((replacement = potential));
100101
}

0 commit comments

Comments
 (0)