Skip to content

Commit 039a7ba

Browse files
committed
JS: Handle .d.mts files when generating module bindings
1 parent a5f2c94 commit 039a7ba

File tree

1 file changed

+6
-0
lines changed
  • javascript/extractor/lib/typescript/src

1 file changed

+6
-0
lines changed

javascript/extractor/lib/typescript/src/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,12 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
670670
if (file.endsWith(".d.ts")) {
671671
return pathlib.basename(file, ".d.ts");
672672
}
673+
if (file.endsWith(".d.mts") || file.endsWith(".d.cts")) {
674+
// We don't extract d.mts or d.cts files, but their symbol can coincide with that of a d.ts file,
675+
// which means any module bindings we generate for it will ultimately be visible in QL.
676+
let base = pathlib.basename(file);
677+
return base.substring(0, base.length - '.d.mts'.length);
678+
}
673679
let base = pathlib.basename(file);
674680
let dot = base.lastIndexOf('.');
675681
return dot === -1 || dot === 0 ? base : base.substring(0, dot);

0 commit comments

Comments
 (0)