Skip to content

Commit

Permalink
fix: Use proper library name check
Browse files Browse the repository at this point in the history
  • Loading branch information
matz3 committed Mar 22, 2024
1 parent f4a370e commit 664ad61
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/detectors/typeChecker/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ export async function createVirtualCompilerHost(
const moduleName = fileName.match(/\/types\/@ui5\/linter\/dynamic-types\/(.*)\.d\.ts/)?.[1];
if (moduleName) {
const libraryNameCheck = moduleName?.replace(/\//g, ".");
const libraryName = SAPUI5_TYPES_FILES.find(($) => libraryNameCheck.startsWith($));
if (libraryNameCheck.startsWith("sap.ui.core.") || !libraryNameCheck.startsWith("sap.")) {
// sap.ui.core is loaded by default
return;
}
const libraryName = SAPUI5_TYPES_FILES.find(($) => libraryNameCheck.startsWith($ + "."));
if (libraryName) {
sourceText = `/// <reference path="/types/@sapui5/types/types/${libraryName}.d.ts"/>`;
} else {
Expand Down

0 comments on commit 664ad61

Please sign in to comment.