Skip to content

Commit

Permalink
Merge pull request #437 from nohehf/fix/ts-imports-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikvanantwerpen authored May 31, 2024
2 parents 558d1da + c43fa8b commit 63e2d6e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ attribute node_symbol = node => symbol = (source-text node), source_n

; module reference
var mod_scope = mod_ref__ns
scan (path-normalize mod_path) {
; normalize path and remove the extension as we want to match 'foo', 'foo.js', 'foo.ts', etc.
scan (path-normalize (replace mod_path "\.(js|ts|jsx|tsx)$" "")) {
"([^/]+)/?" {
node mod_ref
attr (mod_ref) push_symbol = $1
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* --- path: src/foo.ts --- */
export const bar = 42;

/* --- path: src/index.ts --- */
import { bar } from "./foo.js";
// ^ defined: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* --- path: src/foo.ts --- */
export const bar = 42;

/* --- path: src/index.ts --- */
import { bar } from "./foo";
// ^ defined: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* --- path: src/foo.ts --- */
export const bar = 42;

/* --- path: src/index.ts --- */
import { bar } from "./foo.ts";
// ^ defined: 2

0 comments on commit 63e2d6e

Please sign in to comment.