Skip to content

Commit e6407a8

Browse files
committed
PR feedback
1 parent fdf4432 commit e6407a8

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29679,6 +29679,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2967929679
if (!canCollectSymbolAliasAccessabilityData) {
2968029680
return;
2968129681
}
29682+
if (location.flags & NodeFlags.Ambient && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
29683+
// References within types and declaration files are never going to contribute to retaining a JS import,
29684+
// except for properties (which can be decorated).
29685+
return;
29686+
}
2968229687
switch (hint) {
2968329688
case ReferenceHint.Identifier:
2968429689
return markIdentifierAliasReferenced(location as Identifier);

tests/baselines/reference/importDeclWithDeclareModifier.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
importDeclWithDeclareModifier.ts(5,9): error TS1029: 'export' modifier must precede 'declare' modifier.
2-
importDeclWithDeclareModifier.ts(5,27): error TS2708: Cannot use namespace 'x' as a value.
32
importDeclWithDeclareModifier.ts(5,29): error TS2694: Namespace 'x' has no exported member 'c'.
43

54

6-
==== importDeclWithDeclareModifier.ts (3 errors) ====
5+
==== importDeclWithDeclareModifier.ts (2 errors) ====
76
module x {
87
interface c {
98
}
109
}
1110
declare export import a = x.c;
1211
~~~~~~
1312
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
14-
~
15-
!!! error TS2708: Cannot use namespace 'x' as a value.
1613
~
1714
!!! error TS2694: Namespace 'x' has no exported member 'c'.
1815
var b: a;

tests/baselines/reference/importDeclWithDeclareModifier.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
1515
exports.a = void 0;
1616
exports.a = x.c;
1717
var b;
18+
19+
20+
!!!! File importDeclWithDeclareModifier.js differs from original emit in noCheck emit
21+
//// [importDeclWithDeclareModifier.js]
22+
===================================================================
23+
--- Expected The full check baseline
24+
+++ Actual with noCheck set
25+
@@ -1,5 +1,3 @@
26+
"use strict";
27+
Object.defineProperty(exports, "__esModule", { value: true });
28+
-exports.a = void 0;
29+
-exports.a = x.c;
30+
var b;

tests/baselines/reference/reexportedMissingAlias.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
second.d.ts(1,27): error TS2304: Cannot find name 'CompletelyMissing'.
21
second.d.ts(1,27): error TS2503: Cannot find namespace 'CompletelyMissing'.
32

43

5-
==== second.d.ts (2 errors) ====
4+
==== second.d.ts (1 errors) ====
65
export import Component = CompletelyMissing;
76
~~~~~~~~~~~~~~~~~
8-
!!! error TS2304: Cannot find name 'CompletelyMissing'.
9-
~~~~~~~~~~~~~~~~~
107
!!! error TS2503: Cannot find namespace 'CompletelyMissing'.
118
==== first.d.ts (0 errors) ====
129
import * as Second from './second';

0 commit comments

Comments
 (0)