Skip to content

Commit fdf4432

Browse files
committed
Don't skip markLinkedReferences on ambients
1 parent 0fd3b42 commit fdf4432

6 files changed

+10
-19
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29679,9 +29679,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2967929679
if (!canCollectSymbolAliasAccessabilityData) {
2968029680
return;
2968129681
}
29682-
if (location.flags & NodeFlags.Ambient) {
29683-
return; // References within types and declaration files are never going to contribute to retaining a JS import
29684-
}
2968529682
switch (hint) {
2968629683
case ReferenceHint.Identifier:
2968729684
return markIdentifierAliasReferenced(location as Identifier);

tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=commonjs).js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
2626
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2727
};
2828
Object.defineProperty(exports, "__esModule", { value: true });
29+
const observable_1 = require("./observable");
2930
function whatever(a, b) { }
3031
class Test {
3132
}

tests/baselines/reference/decoratorMetadataElidedImportOnDeclare(module=esnext).js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
2424
var __metadata = (this && this.__metadata) || function (k, v) {
2525
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2626
};
27+
import { Observable } from './observable';
2728
function whatever(a, b) { }
2829
class Test {
2930
}
3031
__decorate([
3132
whatever,
3233
__metadata("design:type", Observable)
3334
], Test.prototype, "prop", void 0);
34-
export {};

tests/baselines/reference/importDeclWithDeclareModifier.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
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.
23
importDeclWithDeclareModifier.ts(5,29): error TS2694: Namespace 'x' has no exported member 'c'.
34

45

5-
==== importDeclWithDeclareModifier.ts (2 errors) ====
6+
==== importDeclWithDeclareModifier.ts (3 errors) ====
67
module x {
78
interface c {
89
}
910
}
1011
declare export import a = x.c;
1112
~~~~~~
1213
!!! error TS1029: 'export' modifier must precede 'declare' modifier.
14+
~
15+
!!! error TS2708: Cannot use namespace 'x' as a value.
1316
~
1417
!!! error TS2694: Namespace 'x' has no exported member 'c'.
1518
var b: a;

tests/baselines/reference/importDeclWithDeclareModifier.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,3 @@ 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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
second.d.ts(1,27): error TS2304: Cannot find name 'CompletelyMissing'.
12
second.d.ts(1,27): error TS2503: Cannot find namespace 'CompletelyMissing'.
23

34

4-
==== second.d.ts (1 errors) ====
5+
==== second.d.ts (2 errors) ====
56
export import Component = CompletelyMissing;
67
~~~~~~~~~~~~~~~~~
8+
!!! error TS2304: Cannot find name 'CompletelyMissing'.
9+
~~~~~~~~~~~~~~~~~
710
!!! error TS2503: Cannot find namespace 'CompletelyMissing'.
811
==== first.d.ts (0 errors) ====
912
import * as Second from './second';

0 commit comments

Comments
 (0)