diff --git a/src/service/transformer/declaration-bundler/util/get-type-reference-module-from-file-name.ts b/src/service/transformer/declaration-bundler/util/get-type-reference-module-from-file-name.ts index 722a8c8..5f77cc5 100644 --- a/src/service/transformer/declaration-bundler/util/get-type-reference-module-from-file-name.ts +++ b/src/service/transformer/declaration-bundler/util/get-type-reference-module-from-file-name.ts @@ -14,8 +14,10 @@ export interface TypeReference { export function getTypeReferenceModuleFromFileName({host, fileName}: GetTypeReferenceModuleFromFileNameOptions): TypeReference | undefined { for (const typeRoot of host.getTypeRoots()) { - if (!fileName.includes(typeRoot)) continue; - const base = path.normalize(fileName.slice(typeRoot.length + 1)); + const typeRootIndex = fileName.indexOf(typeRoot); + if (typeRootIndex < 0) continue; + + const base = path.normalize(fileName.slice(typeRootIndex + typeRoot.length + 1)); const moduleSpecifier = base.includes("/") ? base.slice(0, base.indexOf("/")) : base; if (typeModuleReferenceIsAllowed({host, moduleSpecifier})) { diff --git a/test/util/test-runner.ts b/test/util/test-runner.ts index ef1a8e5..ab3cb57 100644 --- a/test/util/test-runner.ts +++ b/test/util/test-runner.ts @@ -80,14 +80,12 @@ for (const [specifier, range] of Object.entries(devDependencies)) { if (TS_OPTIONS_ENTRIES.size === 0) { throw new Error(`The TS_VERSION environment variable matches none of the available TypeScript versions. -Filter: ${process.env.TS_VERSION} -Available TypeScript versions: ${[...TS_OPTIONS_ENTRIES.keys()].join(", ")}`); +Filter: ${process.env.TS_VERSION}`); } if (ROLLUP_OPTIONS_ENTRIES.size === 0) { throw new Error(`The ROLLUP_VERSION environment variable matches none of the available Rollup versions. -Filter: ${process.env.ROLLUP_VERSION} -Available Rollup versions: ${[...ROLLUP_OPTIONS_ENTRIES.keys()].join(", ")}`); +Filter: ${process.env.ROLLUP_VERSION}`); } interface TestRunOptions {