summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/integration/check_tests.rs6
-rw-r--r--cli/tests/testdata/declaration_header_file_with_no_exports.ts2
-rw-r--r--cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts0
-rw-r--r--cli/tests/testdata/declaration_header_file_with_no_exports_js.js1
-rw-r--r--cli/tsc/99_main_compiler.js4
5 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/integration/check_tests.rs b/cli/tests/integration/check_tests.rs
index dca41a1e4..8000ddc9d 100644
--- a/cli/tests/integration/check_tests.rs
+++ b/cli/tests/integration/check_tests.rs
@@ -37,3 +37,9 @@ itest!(module_detection_force {
args: "check --quiet module_detection_force.ts",
output_str: Some(""),
});
+
+// Regression test for https://github.com/denoland/deno/issues/14937.
+itest!(declaration_header_file_with_no_exports {
+ args: "check --quiet declaration_header_file_with_no_exports.ts",
+ output_str: Some(""),
+});
diff --git a/cli/tests/testdata/declaration_header_file_with_no_exports.ts b/cli/tests/testdata/declaration_header_file_with_no_exports.ts
new file mode 100644
index 000000000..ef5da7a38
--- /dev/null
+++ b/cli/tests/testdata/declaration_header_file_with_no_exports.ts
@@ -0,0 +1,2 @@
+import * as foo from "./declaration_header_file_with_no_exports_js.js";
+console.log(foo);
diff --git a/cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts b/cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/cli/tests/testdata/declaration_header_file_with_no_exports_js.d.ts
diff --git a/cli/tests/testdata/declaration_header_file_with_no_exports_js.js b/cli/tests/testdata/declaration_header_file_with_no_exports_js.js
new file mode 100644
index 000000000..b8ae2bcef
--- /dev/null
+++ b/cli/tests/testdata/declaration_header_file_with_no_exports_js.js
@@ -0,0 +1 @@
+/// <reference types="./declaration_header_file_with_no_exports_js.d.ts" />
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index 527a4964f..7650ff95b 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -188,6 +188,10 @@ delete Object.prototype.__proto__;
/** Diagnostics that are intentionally ignored when compiling TypeScript in
* Deno, as they provide misleading or incorrect information. */
const IGNORED_DIAGNOSTICS = [
+ // TS2306: File '.../index.d.ts' is not a module.
+ // We get this for `x-typescript-types` declaration files which don't export
+ // anything. We prefer to treat these as modules with no exports.
+ 2306,
// TS2688: Cannot find type definition file for '...'.
// We ignore because type defintion files can end with '.ts'.
2688,