Skip to content

Commit

Permalink
Handling declaration of modules that are "unknown" i.e. there is no v…
Browse files Browse the repository at this point in the history
…alue declaration for them

Fixes #312
  • Loading branch information
timocov committed Apr 2, 2024
1 parent 21f2803 commit 186e6fd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bundle-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ export function generateDtsBundle(entries: readonly EntryPointConfig[], options:
return;
}

const referencedModuleInfo = getReferencedModuleInfo(moduleDecl, criteria, typeChecker);
const referencedModuleInfo = getModuleLikeModuleInfo(moduleDecl, criteria, typeChecker);
if (referencedModuleInfo === null) {
return;
}
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/test-cases/declare-unknown-modules/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { TestCaseConfig } from '../../test-cases/test-case-config';

const config: TestCaseConfig = {
output: {
inlineDeclareExternals: true,
},
};

export = config;
1 change: 1 addition & 0 deletions tests/e2e/test-cases/declare-unknown-modules/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('../run-test-case').runTestCase(__dirname);
3 changes: 3 additions & 0 deletions tests/e2e/test-cases/declare-unknown-modules/input.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference path="./modules.d.ts" preserve="true" />

export {};
4 changes: 4 additions & 0 deletions tests/e2e/test-cases/declare-unknown-modules/modules.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.css' {}

declare module 'module-that-does-not-exist-actually' {
}
5 changes: 5 additions & 0 deletions tests/e2e/test-cases/declare-unknown-modules/output.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "*.css" { }
declare module "module-that-does-not-exist-actually" {
}

export {};

0 comments on commit 186e6fd

Please sign in to comment.