Skip to content

Commit

Permalink
fix(check): ignore TS2306 (#14940)
Browse files Browse the repository at this point in the history
Fixes a regression where this type checking error was being surfaced in certain scenarios.
  • Loading branch information
nayeemrmn authored Jun 23, 2022
1 parent 13f47ec commit ef7bc5e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/tests/integration/check_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(""),
});
2 changes: 2 additions & 0 deletions cli/tests/testdata/declaration_header_file_with_no_exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as foo from "./declaration_header_file_with_no_exports_js.js";
console.log(foo);
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="./declaration_header_file_with_no_exports_js.d.ts" />
4 changes: 4 additions & 0 deletions cli/tsc/99_main_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ef7bc5e

Please sign in to comment.