Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix errors from merge
  • Loading branch information
andrewbranch committed Aug 18, 2021
commit b5ed171f0bcd700e9728d7888c2fc3c5895ca2bf
5 changes: 4 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38607,7 +38607,10 @@ namespace ts {
error(node, message, symbolToString(symbol));
}

const isDeclaredTypeOnly = isTypeOnlyImportOrExportDeclaration(node);
// Type assertion to defeat the type predicate aliasing of `node` here because
// `isTypeOnlyImportOrExportDeclaration` is a one-sided type guard so `!isDeclaredTypeOnly`
// does not actually imply any narrowing effect on `node`.
const isDeclaredTypeOnly = isTypeOnlyImportOrExportDeclaration(node as never);
Comment thread
andrewbranch marked this conversation as resolved.
Outdated
if (compilerOptions.isolatedModules
&& !isDeclaredTypeOnly
&& !(node.flags & NodeFlags.Ambient)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests/cases/conformance/externalModules/typeOnly/b.ts(1,19): error TS1434: 'D' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/b.ts(1,19): error TS1444: 'D' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/d.ts(1,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead.
tests/cases/conformance/externalModules/typeOnly/e.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
tests/cases/conformance/externalModules/typeOnly/e.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
Expand All @@ -13,7 +13,7 @@ tests/cases/conformance/externalModules/typeOnly/e.ts(2,1): error TS1202: Import
==== tests/cases/conformance/externalModules/typeOnly/b.ts (1 errors) ====
import a, { b, c, D } from "./a";
~
!!! error TS1434: 'D' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1444: 'D' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.

==== tests/cases/conformance/externalModules/typeOnly/c.ts (0 errors) ====
import * as a from "./a";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ export {};
//// [c.fixed.js]
export {};
//// [d.js]
export { A as AA } from "./a";
export { B as BB } from "./b";
export {};
//// [d.fixed.js]
export {};
//// [e.js]
export {};
//// [e.fixed.js]
export {};
//// [f.js]
export { A, B as BB };
export {};
//// [f.fixed.js]
export {};
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
tests/cases/conformance/externalModules/typeOnly/c.ts(1,8): error TS1434: 'DefaultA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(2,10): error TS1434: 'A' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(3,8): error TS1436: 'DefaultB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(4,10): error TS1436: 'B' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(1,8): error TS1444: 'DefaultA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(2,10): error TS1444: 'A' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(3,8): error TS1446: 'DefaultB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/c.ts(4,10): error TS1446: 'B' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/d.ts(1,10): error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
tests/cases/conformance/externalModules/typeOnly/d.ts(2,10): error TS1438: 'B' resolves to a type-only declaration and must be re-exported with a type-only re-export when 'isolatedModules' is enabled.
tests/cases/conformance/externalModules/typeOnly/e.ts(1,10): error TS1434: 'AA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/e.ts(1,14): error TS1436: 'BB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/d.ts(2,10): error TS1448: 'B' resolves to a type-only declaration and must be re-exported with a type-only re-export when 'isolatedModules' is enabled.
tests/cases/conformance/externalModules/typeOnly/e.ts(1,10): error TS1444: 'AA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
tests/cases/conformance/externalModules/typeOnly/e.ts(1,14): error TS1446: 'BB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.


==== tests/cases/conformance/externalModules/typeOnly/a.ts (0 errors) ====
Expand All @@ -19,17 +19,17 @@ tests/cases/conformance/externalModules/typeOnly/e.ts(1,14): error TS1436: 'BB'
==== tests/cases/conformance/externalModules/typeOnly/c.ts (4 errors) ====
import DefaultA from "./a";
~~~~~~~~
!!! error TS1434: 'DefaultA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1444: 'DefaultA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
import { A } from "./a";
~
!!! error TS1434: 'A' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1444: 'A' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
import DefaultB from "./b";
~~~~~~~~
!!! error TS1436: 'DefaultB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1446: 'DefaultB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! related TS1377 tests/cases/conformance/externalModules/typeOnly/b.ts:2:18: 'DefaultB' was exported here.
import { B } from "./b";
~
!!! error TS1436: 'B' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1446: 'B' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! related TS1377 tests/cases/conformance/externalModules/typeOnly/b.ts:2:15: 'B' was exported here.

==== tests/cases/conformance/externalModules/typeOnly/c.fixed.ts (0 errors) ====
Expand All @@ -44,7 +44,7 @@ tests/cases/conformance/externalModules/typeOnly/e.ts(1,14): error TS1436: 'BB'
!!! error TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'.
export { B as BB } from "./b";
~~~~~~~
!!! error TS1438: 'B' resolves to a type-only declaration and must be re-exported with a type-only re-export when 'isolatedModules' is enabled.
!!! error TS1448: 'B' resolves to a type-only declaration and must be re-exported with a type-only re-export when 'isolatedModules' is enabled.
!!! related TS1377 tests/cases/conformance/externalModules/typeOnly/b.ts:2:15: 'B' was exported here.

==== tests/cases/conformance/externalModules/typeOnly/d.fixed.ts (0 errors) ====
Expand All @@ -54,9 +54,9 @@ tests/cases/conformance/externalModules/typeOnly/e.ts(1,14): error TS1436: 'BB'
==== tests/cases/conformance/externalModules/typeOnly/e.ts (2 errors) ====
import { AA, BB } from "./d";
~~
!!! error TS1434: 'AA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1444: 'AA' is a type and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
~~
!!! error TS1436: 'BB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! error TS1446: 'BB' resolves to a type-only declaration and must be imported with a type-only import when 'noErasingImportedNames' and 'isolatedModules' are both enabled.
!!! related TS1377 tests/cases/conformance/externalModules/typeOnly/b.ts:2:15: 'BB' was exported here.

==== tests/cases/conformance/externalModules/typeOnly/e.fixed.ts (0 errors) ====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ export {};
//// [c.fixed.js]
export {};
//// [d.js]
export { A as AA } from "./a";
export { B as BB } from "./b";
export {};
//// [d.fixed.js]
export {};
//// [e.js]
export {};
//// [e.fixed.js]
export {};
//// [f.js]
export { A, B as BB };
export {};
//// [f.fixed.js]
export {};