diff --git a/.travis.yml b/.travis.yml
index 4a99aaf2237fd..27b14739d8b10 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,7 @@ matrix:
branches:
only:
- master
+ - release-2.5
install:
- npm uninstall typescript --no-save
diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index 15fd97ca5ba8d..89e718e48cc59 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -791,12 +791,17 @@ namespace ts {
// 2. inside a function
// 3. inside an instance property initializer, a reference to a non-instance property
// 4. inside a static property initializer, a reference to a static method in the same class
+ // 5. inside a TS export= declaration (since we will move the export statement during emit to avoid TDZ)
// or if usage is in a type context:
// 1. inside a type query (typeof in type position)
- if (usage.parent.kind === SyntaxKind.ExportSpecifier) {
+ if (usage.parent.kind === SyntaxKind.ExportSpecifier || (usage.parent.kind === SyntaxKind.ExportAssignment && (usage.parent as ExportAssignment).isExportEquals)) {
// export specifiers do not use the variable, they only make it available for use
return true;
}
+ // When resolving symbols for exports, the `usage` location passed in can be the export site directly
+ if (usage.kind === SyntaxKind.ExportAssignment && (usage as ExportAssignment).isExportEquals) {
+ return true;
+ }
const container = getEnclosingBlockScopeContainer(declaration);
return isInTypeQuery(usage) || isUsedInFunctionOrInstanceProperty(usage, declaration, container);
diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt b/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt
deleted file mode 100644
index e484d4096bb78..0000000000000
--- a/tests/baselines/reference/exportAssignmentOfGenericType1.errors.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-tests/cases/compiler/exportAssignmentOfGenericType1_0.ts(1,10): error TS2449: Class 'T' used before its declaration.
-
-
-==== tests/cases/compiler/exportAssignmentOfGenericType1_1.ts (0 errors) ====
- ///
- import q = require("exportAssignmentOfGenericType1_0");
-
- class M extends q { }
- var m: M;
- var r: string = m.foo;
-
-==== tests/cases/compiler/exportAssignmentOfGenericType1_0.ts (1 errors) ====
- export = T;
- ~
-!!! error TS2449: Class 'T' used before its declaration.
- class T { foo: X; }
-
\ No newline at end of file
diff --git a/tests/baselines/reference/exportImport.errors.txt b/tests/baselines/reference/exportImport.errors.txt
deleted file mode 100644
index 4f397d54a557d..0000000000000
--- a/tests/baselines/reference/exportImport.errors.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-tests/cases/compiler/w1.ts(1,1): error TS2449: Class 'Widget1' used before its declaration.
-tests/cases/compiler/w1.ts(1,10): error TS2449: Class 'Widget1' used before its declaration.
-
-
-==== tests/cases/compiler/consumer.ts (0 errors) ====
- import e = require('./exporter');
-
- export function w(): e.w { // Should be OK
- return new e.w();
- }
-==== tests/cases/compiler/w1.ts (2 errors) ====
- export = Widget1
- ~~~~~~~~~~~~~~~~
-!!! error TS2449: Class 'Widget1' used before its declaration.
- ~~~~~~~
-!!! error TS2449: Class 'Widget1' used before its declaration.
- class Widget1 { name = 'one'; }
-
-==== tests/cases/compiler/exporter.ts (0 errors) ====
- export import w = require('./w1');
-
\ No newline at end of file
diff --git a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt b/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt
deleted file mode 100644
index 2945950068a42..0000000000000
--- a/tests/baselines/reference/privacyCheckExternalModuleExportAssignmentOfGenericClass.errors.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts(1,1): error TS2449: Class 'Foo' used before its declaration.
-tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts(1,10): error TS2449: Class 'Foo' used before its declaration.
-
-
-==== tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_1.ts (0 errors) ====
- import Foo = require("./privacyCheckExternalModuleExportAssignmentOfGenericClass_0");
- export = Bar;
- interface Bar {
- foo: Foo;
- }
-==== tests/cases/compiler/privacyCheckExternalModuleExportAssignmentOfGenericClass_0.ts (2 errors) ====
- export = Foo;
- ~~~~~~~~~~~~~
-!!! error TS2449: Class 'Foo' used before its declaration.
- ~~~
-!!! error TS2449: Class 'Foo' used before its declaration.
- class Foo {
- constructor(public a: A) { }
- }
-
\ No newline at end of file