JS: Handle .d.mts files when generating module bindings

This commit is contained in:
Asger F 2022-05-17 17:33:36 +02:00
Родитель a5f2c949d3
Коммит 039a7ba828
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -670,6 +670,12 @@ function handleOpenProjectCommand(command: OpenProjectCommand) {
if (file.endsWith(".d.ts")) { if (file.endsWith(".d.ts")) {
return pathlib.basename(file, ".d.ts"); return pathlib.basename(file, ".d.ts");
} }
if (file.endsWith(".d.mts") || file.endsWith(".d.cts")) {
// We don't extract d.mts or d.cts files, but their symbol can coincide with that of a d.ts file,
// which means any module bindings we generate for it will ultimately be visible in QL.
let base = pathlib.basename(file);
return base.substring(0, base.length - '.d.mts'.length);
}
let base = pathlib.basename(file); let base = pathlib.basename(file);
let dot = base.lastIndexOf('.'); let dot = base.lastIndexOf('.');
return dot === -1 || dot === 0 ? base : base.substring(0, dot); return dot === -1 || dot === 0 ? base : base.substring(0, dot);