Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ namespace ts {
if (importedFile && resolution.isExternalLibraryImport) {
// Since currently irrespective of allowJs, we only look for supportedTypeScript extension external module files,
// this check is ok. Otherwise this would be never true for javascript file
if (!isExternalModule(importedFile)) {
if (!isExternalModule(importedFile) && importedFile.statements.length) {
const start = getTokenPosOfNode(file.imports[i], file);
fileProcessingDiagnostics.add(createFileDiagnostic(file, start, file.imports[i].end - start, Diagnostics.Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition, importedFile.fileName));
}
Expand Down
13 changes: 13 additions & 0 deletions tests/baselines/reference/noErrorOnEmptyDts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//// [tests/cases/compiler/noErrorOnEmptyDts.ts] ////

//// [test.d.ts]


// comment

//// [main.ts]
import "test"

//// [main.js]
"use strict";
require("test");
8 changes: 8 additions & 0 deletions tests/baselines/reference/noErrorOnEmptyDts.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== c:/node_modules/test.d.ts ===

No type information for this code.
No type information for this code.// comment
No type information for this code.
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
8 changes: 8 additions & 0 deletions tests/baselines/reference/noErrorOnEmptyDts.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== c:/node_modules/test.d.ts ===

No type information for this code.
No type information for this code.// comment
No type information for this code.
No type information for this code.=== c:/app/main.ts ===
import "test"
No type information for this code.
8 changes: 8 additions & 0 deletions tests/cases/compiler/noErrorOnEmptyDts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @module: commonjs

// @filename: c:/node_modules/test.d.ts

// comment

// @filename: c:/app/main.ts
import "test"